Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 2116

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 61k
Author
Asked: November 26, 20242024-11-26T02:26:11+00:00 2024-11-26T02:26:11+00:00

How I built SetProgress – Part 3 Automation

  • 61k

In the previous post, I explained how I built SetProgress.

In this post, I am going to explain how I automated progress updates.

Automation was not part of my initial plan. I just wanted to create a simple app which allows a user to design & push a progress bar to Twitter.

Sumudu Siriwardana asked me if the app could calculate & update progress for her #100DaysOfCode challenge.

I thought about it, and I realized that the app doesn't offer much automation. User has to update their progress manually everyday or every week.

Automating #100DaysOfCode

Let me give you a bit of context on 100DaysOfCode.

It has 2 rules

  1. Code minimum an hour every day for the next 100 days.
  2. Tweet your progress every day with the #100DaysOfCode hashtag.

Anyone who is doing this challenge will tweet everyday tagging 100DaysOfCode and a little bit about what they did that day.

Solution

We can fetch all the tweets of a user and check if any one of those have the hashtag 100DaysOfCode.

I used the Twitter search tweets API to get the tweets of a user containing a specific hashtag and in a given date range.

This is how the request looks.

https://api.twitter.com/1.1/search/tweets.json?q=from%3Asdinesh91%20since%3A2021-12-24%20until%3A2021-12-25%20#100DaysOfCode%20-filter%3Aretweets 
Enter fullscreen mode Exit fullscreen mode

These are the query parameters I used

from:sdinesh91 since:2021-12-24 until:2021-12-25 #100DaysOfCode -filter:retweets 
Enter fullscreen mode Exit fullscreen mode

This query returns tweets of a specific user, tweeted within a specific date range and having the specified hashtag. We also don't need to fetch the retweets, so I filter them out.

We don't have to count multiple tweets containing the hastag in a single day. 100DaysOfCode is progress made in days and not in the number of times tweeted.

Having fetched the tweets it is very simple to count the progress. If I find a tweet for any given day, I increment the count. Once I have the count, I update the progress in the database and push the new progress bar to Twitter.

One important aspect of writing a backend job like this, is to make it Idempotent. Being idempotent, ensures that we obtain the same result irrespective of the number of times we run the code. This is critical as backend jobs might fail or timeout. In such cases, we should be able to just rerun the job and things should work as expected.

To make tracker job idempotent, I store the tracker's last run date to each user's config. This allows the tracker to resume processing from where it last left by comparing the last run date.

Tech

I have hosted the tracker on Netlify as a function. I also use EasyCron to trigger the tracker function every day.

nextjssideprojectstwitterwebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 1k
  • Popular
  • Answers
  • Author

    How to ensure that all the routes on my Symfony ...

    • 0 Answers
  • Author

    Insights into Forms in Flask

    • 0 Answers
  • Author

    Kick Start Your Next Project With Holo Theme

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.