DEV Community

Dinesh S
Dinesh S

Posted on

I built my own Tweet scheduler which costs less than 1$ per month

I wanted a simple scheduler that will post tweets from my Notion database to Twitter.

I wanted an app without any bells & whistles, just a dumb scheduler. I did not want to pay 10$/mo just for that. So as any developer would do, I decided to write my own scheduler 😂.

Here's how I did it.

I wrote a script tweeter.js which does the following

  • Fetch content from a Notion database.
  • Prepare the tweet
  • Send it to Twitter based on the scheduled time slot
  • Mark the tweet as posted in Notion.

I have hosted the scheduler in AWS and it runs as a container in ECS.

I use Amazon EventBridge rule to create a new container every 30 minutes. This container when started executes tweeter.js and terminates. This way, I don't have a server running all the time, which in turn results in reduced costs.

It costs less than 1$ a month and I can schedule as many tweets/threads I want.

One caveat is that the tweets schedule time is not accurate to the specific minute. It depends on the frequency at which a new container is created. I have set it to 30 minutes, so if you schedule a tweet between 10:00 & 10:30 all of them would be tweeted at the same time.

References

ECS infrastructure setup - https://github.com/vthub/scheduled-ecs-task

Top comments (10)

Collapse
 
cyco130 profile image
Fatih Aygün

Would using Cloudflare Workers' Cron Triggers (ScheduledEvent) work for this use case? Making it essentially free?

Collapse
 
dineshs91 profile image
Dinesh S

Are Cloudflare workers free? They should be having some sort of cap on their free tier.

Collapse
 
cyco130 profile image
Fatih Aygün

The limits are explained here. Whether your use case will fit in the free plan depends on the volume I guess. 100 000 requests per day and 10 ms of CPU time (excluding IO time) should be plenty though.

Thread Thread
 
dineshs91 profile image
Dinesh S

Sounds good!

Thanks for the suggestion. I am going to try it out.

Collapse
 
alvarolorentedev profile image
Alvaro

I am doing it for free with trello +power automate

Collapse
 
andronasef profile image
Andrew Nasef

Use Github Action for Free 😎

Collapse
 
codewithrabeeh profile image
Rabeeh Ebrahim

It was a nice idea. I also want to schedule tweets like that.

Collapse
 
dineshs91 profile image
Dinesh S

You can give it a try Rabeeh. It's quite simple.

Collapse
 
vsnthdev profile image
Vasanth Srivatsa

Accuracy of publishing time is not that major in my opinion comparing the costs 👌

Collapse
 
dineshs91 profile image
Dinesh S

Yeah. But it also depends on what you want. If you want second or even minute accuracy then one of the paid apps are your best bet. For all other cases this works just fine.