Follow + Reply with Emoji's to my latest tweets/replies to see it live here!.
Inspired from these guys post/work, I tried exploring Twitter API resulting in this experiment.
- Tony Dinh - His Emoji Banner
- Chris Bongers - His Blog post on Dynamic twitter header
- Update your last 3 followers.
- Latest Blog Post title from hashnode Blog post.
- Display the Emoji's from the last 25 replies to my tweets/replies.
- Node JS
- node-twitter-api-v2 for accessing Twitter API v2 & V1.
- Axios, a promise based HTTP client.
- Twitter Emoji, a standard Unicode emoji library.
- JIMP & Merge Img, for Image processing.
- Initialise the twitter client.
- Fetch the Emoji
- Get the latest 25 replies from the Mention Timeline.
- Filter the last 10 Emojis from the text
- Create a 'emoji.png' with emoji's ordered vertically.
- Fetch the latest blog post title from Hashnode GraphQL API.
- Fetch the last 3 twitter followers image & handle.
- Put everything into the banner. 'banner.png' -> 'finalBanner.png'
Apply for Twitter Developer's Account and get your API & Access Keys.
- Create
.env
file in the root folder. - Fill in the below information.
APP_KEY=<Your-Twitter-API-Key> APP_SECRET=<Your-Twitter-API-Secret> ACCESS_TOKEN=<Your-Twitter-Access-Token> ACCESS_SECRET=<Your-Twitter-Access-Secret> TWITTER_HANDLE=<Your-Twitter-Handle> HN_USR_NAME=<Your-Hashnode-Username>
- Create you own
banner.png
of size1500x500px
. Just like me, you can use Figma to create your own banners. Canva is another great option. - Run the below command to install all the dependency.
npm install
- Run the below command to run the script.
npm start
- Your Profile banner will be updated. You need to run this script manually whenever you need to update your banner.
- Craete a github repo and upload this code (without
.env
file) or fork this repo. - Goto
Settings -> Secrets -> Actions
of the repo. - Create
New repository secret
for all your secrets mentioned in.env
file. - Update the Action configuration in
.github\workflows\TwitterBannerUpdate.yml
file to run index.js# Specifies run job. Here it runs every 10m. - cron: "*/10 * * * *" # Envionment Variables updated as per the secrets created. - name: Setup env vars run: | touch .env echo APP_KEY=${{ secrets.APP_KEY }} >> .env echo APP_SECRET=${{ secrets.APP_SECRET }} >> .env echo ACCESS_TOKEN=${{ secrets.ACCESS_TOKEN }} >> .env echo ACCESS_SECRET=${{ secrets.ACCESS_SECRET }} >> .env echo TWITTER_HANDLE=${{ secrets.TWITTER_HANDLE }} >> .env echo HN_USR_NAME=${{ secrets.HN_USR_NAME }} >> .env
A detailed blog post is coming soon! - Will be updated with the link.
For any questions, DM me on twitter.
AGPLv3