Crypto Social Media publishes hourly to popular Cryptocurrency and DeFi (Decentralized Finance) prices to social networks such as Twitter, Facebook, LinkedIn, Telegram, and Reddit. You can use this example to setup any event or dynamic content publishing from your backend server.
The system uses Coin Gecko to obtain the latest prices, determines the percent change since last post, formats the data, and publishes to social media networks using Ayrshare. Everything runs on Firebase using the cloud function scheduler.
You can see the live Twitter example at @CryptoSocialM
- Ayrshare - API to publish to all social networks with one call
- Coin Gecko - get latest coin prices
- Firebase - serverless cloud function and hourly cron job with Firestore for tracking previous prices. You can use any of system such as Digital Ocean or Netlify with a NoSQL database like MongoDB.
- Clone the repository and run npm install.
- Install Firebase CLI and init in the directory. You are free to use another system such as Netlify or Heroku.
- Register with Ayrshare, enable your social media accounts, and get your API key.
- In index.js set AYRSHARE_API_KEY to your key (or set the Firebase env variable).
- Run locally to test and deploy to a production environment such as Firebase.
Firebase Cloud Functions will unload out of memory and reload at certain points. We are saving the previous prices in a simple global variable, so when the a reload occurs, we lose the data. An enhancement would be to store the previous value in Firestore.