How to Create Your Own Twitter Scheduling Tool
Last Updated August 1, 2022 · Custom Software,Web Development
The main type of work we do here at Link Software is creating custom software systems for our clients. In addition, we develop and sell a set of WordPress plugins. Each plugin has its own active marketing website, blog, and Twitter account to manage. One of the stranger aspects of selling a software product like a WordPress plugin is that you are secretly running a content and marketing business as well. Each plugin’s site has regular content added that needs promoting on social media. It was only natural for us to make our own Twitter scheduling tool to help manage this constantly growing amount of content.
We’ve put together this very general guide explaining why and how we built our own Twitter scheduling tool. This is a semi-technical article explaining the technologies we used. There are no code examples because not everyone uses the same technology stack as us. But we do offer a few specific recommendations for software packages we did use. There are alternatives for each, of course, that fit whatever programming environment you work in.
In the end, you should have a good framework in place to start building your own self-promoting Twitter machine for your own content marketing efforts.
Do You Really Need Your Own Twitter Scheduling Tool?
To be honest, the answer is “maybe.”
This isn’t the ideal situation for most businesses. For us, trying to manage multiple products and blogs and Twitter accounts was quite a nuisance. It’s difficult enough to maintain a steady flow of content across all of our WordPress plugin marketing sites. Adding on top of that writing and queueing numerous tweets per post was too much work. We’re juggling client work and our plugins. Setting aside time for social media posting, which is quite repetitive, seemed like an opportunity to do something unique.
Aren’t There Existing Products for This?
There are existing solutions to schedule tweets and queue up social media content. Top-rated services like Buffer have been around for quite a long time. Applications like Buffer let you write individual tweets in advance, set the date they go live, and then you don’t have to worry about anything else until your next piece of content is ready to be promoted.
We actually do use one of these software services to manage tweets on the Link Software Twitter account. Our preferred solution, Missinglettr, does a great job handling the tweets for that account. We get a notification from Missinglettr every time a new post is added to your blog. Then it suggests a sequence of tweets, spread out over the course of 12 months, based on the content of that new post. It’s relatively hands-free.
Why Write Your Own Twitter Scheduling Tool Then?
At scale, when you run multiple content sites, applications like Buffer and Missinglettr aren’t perfect. For example, if we were to use Missinglettr for all of our Twitter accounts, the fees would get high quickly. One of the key pieces of custom software development is juggling the upfront costs versus savings over time using a ready-made application with subscription fees.
The other part, aside from cost, was the repetitive nature of the social media posts we want to make. In short, most of the content on our WordPress sites are plugin lists and rundowns. Listicles like this have a common format and similar content from post to post. We wanted a hands-off approach to taking these posts, breaking them into individual tweets, and sending them out without us having to do much work.
We decided that we could create our own Twitter scheduling tool with a simplified interface. It would be more suited to our needs, be easier to use, and cheaper. This held true. The internal solution we ended up with came together very quickly over the course of a handful of programming hours. It’s not flashy but it meets our needs and scales across multiple marketing websites and Twitter accounts.
Let’s go through the basics of how our internal tool was built and how it works.
The Basic Pieces of a Twitter Scheduling Tool
It doesn’t take a lot to put together your own software to send out tweets.
In fact, we think most programmers and software companies will be familiar with all of the technologies involved already. Twitter’s REST API is very robust and it uses OAuth for authentication. Anyone familiar with working with a third-party API that requires authenticating users is already halfway home. Those are the main things necessary to make this work.
Our Technology Stack
We promised not to get into specific programming examples. Let’s just briefly discuss the technology we used for our application.
We are a PHP software shop so everything we built runs on that language. Our tool uses the Bird Elephant package to interface with the API. It also uses the Twitter Provider for the PHP League’s OAuth 2.0 client.
The Twitter API is very flexible and there are plenty of libraries available for your own programming language of choice. You should be able to find pre-built code to get you started building your own Twitter scheduling tool.
Create a Twitter Developer Account
First, you’re going to need to sign up for the Twitter Developer Platform. You’ll need an active Twitter account with a validated phone number attached to it. The phone number piece is important so make sure you have that set up in your profile before starting. Once you have gained access to the platform it’s time to make your Twitter app inside of the Developer Portal.
Create Your App in the Twitter Developer Portal
From the Developer Portal, make an App. You can call it whatever you want but the name must be unique.
Generate the API Key and API Secret for your app. You’ll also want to generate OAuth 2.0 Client ID and Client Secret tokens as well. Make sure you save all of those in a safe place, like an environment file, for your app to pull from when necessary.
Once you have those tokens ready you are done with using the Twitter Developer Portal.
How Our Twitter Scheduling Tool Works
Let’s talk about how our tool actually works now that we have the basic setup explained. This is the fun programming part of the process. You’ll need to write authentication scripts to give your app permission to use Twitter accounts. Then you need to build a collection of tweets. Finally, you’ll have to write code to regularly pull those tweets and send them out from the correct account.
Grant Permissions Through Authentication
As we said before, each of our marketing sites has a corresponding Twitter account. Those accounts need to authenticate and give permission to our Twitter scheduling tool.
We wrote a simple script that generates an authentication URL that we can use to go to Twitter and sign in with our accounts. The authentication URL includes the scopes our tool needs to post and follow users on behalf of the account we are authenticating. Once we complete the process, Twitter redirects back to a callback URL we defined and passes us access and refresh tokens to use with the account in question.
This is, by far, the most complicated part of the whole process if you are unfamiliar with OAuth. It can take some time to get used to the concept of tokens, scope, and the other pieces necessary to make this work. It can take some trial and error to get everything right.
Eventually, when it is running correctly, you will have tokens you can use with the Twitter API to tweet on behalf of any account that has authenticated with your app.
Build a Collection of Tweets
For our use case, we want to write a handful of tweets about any given blog post. Then we want to store those tweets in a database so our Twitter scheduling tool can pull and tweet them out automatically. Once our tool was up and running, this part is the only bit of ongoing work we need to do and it only takes a few minutes after each time we publish content.
Let’s use a specific example from one of our actual sites. For the White Label blog, we regularly write listicles describing WordPress plugins our customers might find useful in their client projects. One of those posts runs down some of the most popular WordPress local SEO plugins.
After the post went live, we added a handful of tweets to our database. Each record in the database includes:
- The URL of the post
- A short piece of text describing what the post is about. Sometimes we include the Twitter username of a developer who makes a plugin we mention in the post.
- Additional data we use like UTM codes and hashtags.
The URL and the text are the two most important parts.
Notice we mention that sometimes the text includes a Twitter username. We’ll explain why that is important in our next section. We use UTM codes in the link we include with the tweet but that’s not a requirement. Hashtags are always nice but they are generally generic for us. We use #WordPress and #WooCommerce quite a bit.
This whole process comes together pretty quickly. We write, on average, five tweets per published post.
Start Sending Out Tweets
Our app can connect to your Twitter accounts. It has a collection of pre-written tweets to use. It’s finally time to start sending out tweets.
The final piece of our Twitter scheduling tool is a script that executes every morning. It finds a post we haven’t tweeted about in a long time for each of our marketing sites. Once it’s identified a post it finds a tweet we wrote that also hasn’t been sent out in a long time. Finally, the tool collects all of the tweet’s data and generates a post on the corresponding account.
Here’s an example of a tweet our app sent out for the local SEO post we used in the example above:
More Than Just an Auto-Poster
A Twitter scheduling tool can do more than just blindly post tweets on a timeline. It can interact directly with Twitter users as well. We mentioned earlier that our tweets often contain the Twitter usernames of plugin developers. When the tool collects data for each day’s tweet it analyzes the text to identify any usernames. If it finds some, it will go out and follow those accounts before it actually posts the tweet.
This helps grow our account and generate awareness of our tweets, and posts, from the people whose plugins we are actively discussing. Again, our goal is to do hands-off social media marketing and posting and following users is a great way for our Twitter scheduling tool to help us do that.
As we said at the top, this isn’t the best path for everyone. Most businesses and marketers will find existing tools like Buffer or Missinglettr perfect for their needs. But custom software is all about meeting the needs of situations in which regular software won’t do. In our case, this was the perfect excuse to practice what we preach and make our own application.
Are you interested in building your own Twitter scheduling tool? Hopefully, if you are a developer, this guide will get you started or give you some good ideas. Not a developer? Reach out to us using the contact form below and we’d be happy to answer any questions you might have. We build custom software applications all of the time and would be happy to listen to your ideas.