January 14th, 2019
Over the last year, I’ve done a bunch of work automating stuff for Starter Story. One of the bigger automations I shipped was social media.

Today, my Twitter, Instagram, and Facebook accounts are 100% self sufficient, posting daily content without any work from me :)

As a solo founder, I believe it’s important to automate as much as you can. Freeing up your time is crucial to getting more done. Also, as a programmer - automating things is fun and it’s a pretty cool feeling to have code working for you while you sleep!

I’ve had a few people ask me about this on Twitter, so I figured I’d write a quick blog post about why and how I did this.

Note - this post is about automating my business social media accounts. I think automating stuff on your personal accounts or using bots is bad.

Why I automated social media

As with anything, there are advantages and disadvantages of having an automated system. First I'll talk about the advantages:

Save time!

I publish new articles on Starter Story every day, so reposting those stories on three different social media platforms is time consuming!

Let’s say that it takes 5 minutes to publish each post on social media… With 7 articles a week on 3 platforms, that’s a couple hours of work per week saved.

No longer think about it

You know when you’re working on something important (and unrelated) and you then you realize you need to do something else that is time sensitive (like post on social media)?

For me, that is extremely disruptive to productivity. Little things like that can derail my focus and lead to getting way less things done.

Now, I no longer think about social media. I turn notifications off for those accounts and I rarely check them. It’s one less thing I have to think about.

Computers are loyal
Humans are forgetful and lazy.

For me, it’s hard to do simple repeatable tasks over long periods of time unless I can turn them into habits.

If you don’t have clear systems for tasks, I will probably forget about them or be too lazy to take action.

But... computers are not forgetful or lazy!

A computer doesn't make mistakes - it always shows up on time, and it never complains :)

There are some downsides to automating
Let’s be honest - the main downside to automating social media is less audience engagement (likes, comments, etc).
Because it's automated, you have less room to be creative and spontaneous in your posts - and your post likely won’t go viral or something like that.

Your followers will also likely catch on that your content is automated in some way. If they perceive this, they may be less likely to like, comment, or engage with it.

So, I think you need to weigh the pros and cons.

Is social media your main marketing channel?

If it came down to a question of automating or not - I think this is the question that can help answer it…

Is social media your main marketing or acquisition channel? 

If not, then I think you should just automate it and forget about it. If it is, then you should probably not automate and put a lot of work into your posts.

For Starter Story, my main acquisition channels are Reddit and search engines. I get, maybe, 10% of my traffic from social media, so for me it makes sense to just automate it.
Automation is an iterative process

Here's something that I don't hear people talking about enough…

Automation is a slow, iterative process (at least for me).

I didn't have my social media automated in one night. In fact it probably took me months to have the thing full automated.

Start with a manual process - then slowly work towards automation
My process always starts manually.

I want to see what works and get a feel for the work involved. Then, I work (slowly) towards automation.

For example - how do hashtags work on Instagram? I had some trial and error there, and learned some things by manually testing it out.

Seeing what works and what doesn't is important and can later inform you on what to automate.

Building automated systems is complicated
A truly automated system is not built overnight (at least for me).

There are many moving parts and I often can't code it up in a couple hours session. So I'll usually start by automating the most time consuming thing.

For example, the first thing I automated was the image assets, this is what they look like today:

Before I had these automated, I was manually creating these assets in Canva! This was a process that took at least 10 minutes, but I felt it was important, especially for social media link previews.

So, this was the first thing I automated - it would save me the most time and it was clear what I needed to do.

Step 1: I designed that image with HTML/CSS and then just started manually taking screenshots of it which saved 10 minutes per post.

Step 2: I set up a screenshot service to automatically do the screenshotting.

Step 3: I wrote the code generates the copy for the social media post, etc etc.

And I did this over a longer period of time. Breaking it up into smaller tasks allowed me to save time with each task, but also not get overwhelmed with the project.

How I did it

Now that I explained some of the why and my high level thoughts, I'll go over the specific implementation.

The creative

It's easy to just automate posting text to social media, but generating dynamic image assets was quite a challenge for me!

The way I do it today is I have a special page that has HTML/CSS that looks like the image.

It's just a regular page on my website, you can see a live version in action here:

Notice the last two paths in that URL? That controls the width and height of the assets.

For instagram I use a "square" image, where Facebook/Twitter I use a more rectangular shape.

Taking screenshots

Now, I have to convert that page into an image.

This part was actually sort of challenging! I couldn't find a good (and free) solution at all.

PhantomJS usually works pretty well, but the issue I ran into was that it doesn't support Flexbox and other CSS stuff that I needed. The screenshots came out all wonky.

I ended up finding a puppeteer based solution - which supports Flexbox - here. You can also specify the width and the height of the screenshot browser window - it was perfect.

Once I take a screenshot of the image I upload it to S3. I also use that image as the og:image for the article page.

I will spare you my code on this because it is absolutely horrendous.

I have some logic set up in my app that anytime a story is updated, a job will run to take a new screenshot. So if the title is updated, I get a new screenshot automatically.

Posting to social media

Now that I have my images (the hardest part IMO) I have to actually post them to social media.

I run a sidekiq job once every morning that looks at every published post the day before and runs the code to post those to Buffer.

Logistically, this allows me to make last minute changes to posts or still post something later in the day, knowing that the social media worker will run the day after publish.

Social media API

I post to social media using the Buffer API - their API is fucking amazing and the best part is that it supports Instagram - which at the time of writing is a very new API.

What's nice about using Buffer is their queue system. When I add a post to Buffer, it doesn't immediately post right away, it gets queued up to be posted based on a schedule I set - which is customizable by the platform.

Here’s my Instagram schedule:

This is nice because my worker runs early in the morning and sometimes I have multiple posts getting published in one day but I'd like the social media posts to be spread apart.

Here is the basic code I wrote to post to the Buffer API. Super easy!

Generating copy

This is another possibly overlooked, but easy thing to make your posts look a bit less automated.

Different platforms have different standards or expectations of the "copy" or text that goes into the post.

For example:
  • Twitter only allows 280 characters.
  • Instagram doesn't allow links.
  • You can put a ton of text inside Instagram caption.
I won't go into too much detail here but will show a few screenshots of what my copy looks like:

For Instagram, I have a set of 1-200 hashtags and I randomly select 30 to include in the bottom of the description.

Tagging people

Another easy thing to do that will help with engagement - tag people in your posts!

When people get tagged, they get notified! Which may mean more retweets, shares, followers, etc.

In my interview form, I try to get people’s Instagram, facebook, etc handles and I save them in my database.

When I go to write the copy for the post, I check to see if they exist in my database and include it in the copy if it is.

Other social media posts I've automated

Other than just new posts whenever I have a new story, I also have automation set up for a couple other things.

Twitter Quotes
I run a daily worker that picks an article at random, finds blockquotes inside the article, and then posts them to Twitter.

Only took me like an hour to write that code and it's a nice way to switch it up.

Tools posts
Because I have every interviewer record the tools that they work with, I have another Twitter post that tags all of these companies.

A couple weeks after a story is shared, I will create another post that lists out these tools and tags the companies.

It's a nice way to engage the community!

That's it!

Hopefully this post didn't bore you too much!

Although this stuff may seem pretty obvious or whatever, I really did enjoy building these automations and it's a pretty cool feeling to never have to do anything, and having robots working for you while you sleep!

Thanks for reading and please reach out if you have any questions on any of this.