Member-only story

Schedule Tweets in a Ruby on Rails Application

Rutger
3 min readNov 4, 2021

--

Last year Twitter added a new function called “Scheduled Tweets”.

This is useful if you are unable to tweet as you are living in a different timezone than your followers or for example you are planning a holiday.

In this article, I will explain how to set up scheduled tweets for a Rails Application.

Setup access to the Twitter Ads API

Unfortunately, the regular Twitter API does not have a function to schedule tweets. To use scheduled tweets, we need to use the Twitter Ads API

Follows the steps in this article to create an account that has access to the Twitter Ads API.

Setup on Rails on Rails

Now that we have access to the Twitter Ads API, we can start implementing our code to schedule tweets.

  1. Install Twitter Ads Gem into our Gemfile
gem 'twitter-ads'

After adding the gem to our Gemfile, run bundle install

2. Create a new rake file

lib/tasks/twitter_schedule_tweet.rake

--

--

Rutger
Rutger

Written by Rutger

Software Engineer in Tokyo

No responses yet

Write a response