How We Automated Our Fitness Instagram

Written by madsphi | Published 2020/04/13
Tech Story Tags: fitness | instagram | instagram-marketing | instagram-growth | instagram-strategy | digital-avatar | facebook | startups

TLDR Bulk Hackers interview people who do great in fitness and post fitness photos on their website. Their solution was to create avatars and great, motivating quotes from their interviews. The solution is automated using a PHP + JavaScript generator that merges images together in an avatar. The most difficult part was actually not writing the code, but to get the pixels right in order to place the text correctly (i.e. make sure the text didn't extend beyond the edges of the final image etc.) The generator is very similar to the one we have made public.via the TL;DR App

Our website Bulk Hackers interview people who do great in fitness. A big part of the online fitness is Instagram, so just like everybody else we have an Instagram account.
And yes, we know all to well that our Instagram doesn't have a serious number of followers YET.
Our Instagram problem
When we started our Instagram, we had a problem (besides the one about the lack of followers...).
Unlike the athletes we feature, we couldn't just post photos of ourselves in the gym.
We had to come up with another solution and that solution ended up being avatars and great, motivating quotes from our interviews.
With avatars and quotes, we could get a fitness Instagram that would stand out - and even better for a programmer like me, the solution would be something that could be automated.
Creating avatars
Every athlete we interview get an avatar. We design the avatars using a generator we have build ourselves, very much similar to the one we have made public.
I shared some details about the avatar generator previously here on Hacker Noon, but it's basically some PHP + JavaScript that allows the user to select shapes like hair, clothes, etc. and merges images together in an avatar.
Adding quotes
When we put together the interviews on Bulk Hackers, we select sentences and mark them as quotes that will stand out on our site.
The quotes are wrapped in a Wordpress shortcode so they can easily get some CSS and stand out (our site runs on Wordpress with several plugins on top - including some custom plugins).
When the Wordpress shortcode is run, it saves the quote to a table in the database.
Our editor can then check the quotes and mark the best ones as worthy of being shared on our Instagram.
Merging things
We then have a cron job that runs daily, merging the avatars and quotes together into Instagram ready images.
This is done with some PHP - and yes, it is quite easy to work with images in PHP. The most difficult part was actually not writing the code, but to get the pixels right in order to place the text correctly (i.e. make sure the text didn't extend beyond the edges of the final image etc.)
Posting to Instagram
Finally, we have another cron job that takes the Instagram ready images and push them to Buffer through Buffer's excellent API.
At the same time we add some hashtags and a description, so our Instagram posts get extra nice and hopefully attract more followers.
To spice things up, we can also go into Buffer's UI and edit things a bit. For example add extra hashtags or change a description.

Spicing things up might not be 100% automation, but it sure is faster and better than if everything had to be done manually.

Written by madsphi | Programming something
Published by HackerNoon on 2020/04/13