DEV Community

Cover image for Twitter API is 🔥 - Followers Count
Suren
Suren

Posted on

11 6

Twitter API is 🔥 - Followers Count

I see a lot of tweeting platforms, which give you the power to send scheduled tweets, retweets, like all the comments for your tweets, always retweet you fav handle, and so on in Twitter. All these come at a cost, most of them are reasonable.

But this got me thinking and I did some surfing around the net. Then I realized Twitter provides free API (of course with a limit) for developers with small apps.

I added my app, started testing the API and I could replicate some of the Awesome functionalities that the paid services could offer.

An interesting thing I did was creating a bot that reads my followers count and appends that to my Twitter profile's Display Name.

Alt Text

Below are some of the few keys steps in achieving this✨

  1. Go to Twitter's developer page and register your app to get the tokens.

  2. All major languages have an add-on/module available for twitter integration. I have used, Tweepy for Python and Twitter Lite for NodeJS.
    ⚡️ Provide the required authentication and clean check the docs for all the available endpoints.

  3. After the initial setup is done, the next step would be to get the followers count and writing it to the display name.
    ⚡️ Follower count - this could be fetched from one of 2 APIs,
    GET followers/idsGET users/show
    ⚡️ Updated Display Name - to update the profile information to update the use POST account/update_profile by sending the display name with the appended followers count in the name property of the request.

  4. Run a cron job which calls and repeats the above steps in the refresh duration that you want😉

To test more on this implementation, check my profile😉

To look cool, you have multiple pics and use the API to ser them as your display picture at different times of the day🔥

Do follow on twitter to get connected and DM me your comments. Since I have just started to write, do send you love and criticism, both would be equally appreciated😉

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (2)

Collapse
 
shivenigma profile image
Vignesh M

This is a great tip Suren. Thank you.

Collapse
 
radnerus profile image
Suren

Thank you, Vignesh!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay