This is an open source tool made to automatically tweet famous DEV posts to author's twitter account.
I am a technical blogger on DEV. My posts have been getting a lot of traction on the platform, and to me its a news worth sharing with the world. So I started tweeting milestones like 1000 views and all.
At start it was good but, then one day Daily.dev tagged me in a tweet saying "My post got 250 views on their platform".And it got me thinking that "if they can automate it, so can I". And that's how my friends, I started bootstrapping this project.
Fork this project
Create an account on
- DEV
- Vercel
- Twitter Developer
- Atlas
- Rebrandly
Get and setup the following credentials from each platform
DEV_USERNAME=<xxxxxxxxxxxxxxxxxx>
DEV_API_URL=<xxxxxxxxxxxxxxxxxx>
DEV_API_KEY=<xxxxxxxxxxxxxxxxxx>
You can get the API_KEY
from Settings > Account > DEV Community API Keys
This needs to be specified in Vercel Environment variables
Sign up using your GitHub to allow Continuous Deployment.
Sign up for Twitter developer program.
Please read all instructions there to make sure you get an API access to tweet on behalf of your account.
Create a New project > Create New App > Allow Oauth1.0 with Read & Write Access.
Then get the following
CONSUMER_KEY=<xxxxxxxxxxxxxxxxxx>
CONSUMER_KEY_SECRET=<xxxxxxxxxxxxxxxxxx>
TWITTER_ACCESS_TOKEN=<xxxxxxxxxxxxxxxxxx>
TWITTER_ACCESS_TOKEN_SECRET=<xxxxxxxxxxxxxxxxxx>
This needs to be specified in Vercel Environment variables
Sign up on Atlas, create a new cluster, click on Connect > Connect using Application
The DB_NAME should be same as specified in the Connection URI
DB_NAME=<xxxxxxxxxxxxxxxxxx>
ATLAS_URI_PROD=<xxxxxxxxxxxxxxxxxx>
This needs to be specified in Vercel Environment variables
Sign up and register your custom domain there. Then get an API KEY.
SHORTNER_API_KEY=<xxxxxxxxxxxxxxxxxx>
SHORTNER_DOMAIN=<xxxxxxxxxxxxxxxxxx>
This needs to be specified in Vercel Environment variables
Generate a long enough random string to use as API_KEY for your own service.
API_KEY=<xxxxxxxxxxxxxxxxxx>
This needs to be specified at
- Vercel Environment variables
- GitHub Environment variables (to be used by actions)
Copy the same credentials in a .env.local
file for development purposes. A sample .env.development
file is present in repo for help.
- Run
yarn
in the repo - Run
yarn dev
to run local server - Push to remote GitHub to automatically deploy to Vercel.
We want to send a tweet when article X on DEV crosses a pre-defined milestone.
- Run a cron job using GitHub actions
- Fetch all published articles of the Author from DEV
- Post exists in database
- true:
- Check if a new milestone is achieved
- yes:
- Create and post a tweet on Twitter
- Update database entry with new milestone
- no:
- do nothing
- false:
- create a shortUrl using Rebrandly
- create a new database entry for the article
- true:
- Post exists in database
This project is a hobby project, for non-profit. All the tools used here are free and openly available.
- NextJS: this project is bootstrapped using NextJS.
- GitHub: is used for source code management and running the cron jobs using GitHub actions.
- Vercel: as the platform. We use their "Serverless and Edge functions".
- MongoDB: is used to persist milestone information for each article.
- Atlas: is used as Database provider.
- Rebrandly: as a link shortener service
-
Why do we need a link shortener?
The default url provided by DEV are sometimes too long for twitter to load preview and without preview the post doesn't look all that good. So I used a shortener to solve this issue. Rebrandly provides free custom domain usage up to 500 links which is good enough for our use case.