An interactive Twitter banner build in Node.js and hosted on Netlify!
Live banner on my Twitter profile »
Don't forget to give me a follow @Twitter
Table of Contents
The Twitter API enables programmers to access data from their Twitter profile directly. This includes data like Tweets, Direct Messages, Spaces, Lists, users, and more.
This project will leverage the API to interact with your list of followers to create an interactive banner that displays the 4 most recent followers on your Twitter profile.
The banner utilizes a serverless Node.js function that pulls the 4 most recent followers once every hour. Thereafter, the function will overlay the follower's profile picture to the banner image and upload the updated banner to your profile.
There are various places you can run a project like this, but I choose Netlify due to a generous free tier limit and because they allow you to run scheduled functions.
-
Get a free API Key for your Twitter profile at https://developer.twitter.com/
-
Apply for Elevated Access to the Twitter API. Don't worry: this is free.
-
Clone the repo
git clone https://github.com/LarsEjaas/TwitterBanner.git
-
Install NPM packages
npm install
-
Create an
.env
file and add the variables listed in.env.example
replacing the values with the keys from the API.
Netlify CLI is a command line interface that can be used to develop and debug Netlify functions locally. To use the client install it globally:
npm install netlify-cli -g
Read more details about the client at netlify
You can start the client by running:
netlify dev
...and while the client dev environment is running from a separate terminal run the function:
netlify functions:invoke
to test the function locally.
This project comes with no license. Feel free to clone the project and modify it to your liking.
Lars Ejaas - @twitter - Write to me directly on my webpage
The code for this project was inspired by code from several sources. Mainly:
and
How I made my Twitter header dynamic
Please follow Pavel Polívka and Chris Bonkers on Twitter if you like their articles and content: