Sync your Ghost blog with Twitter and Linkedin [aka build your own Zapier]

Zapier is great, I just wanted to see if I can build something myself and self host it.

11/2022 Update: Updated repo.

I wrote a few scripts and automated them with cron on my server.

Here is the basic workflow of the main sync script:

Use the Ghost API to get all the old posts from blog API

Look for post tags
  If tag does not exist, create it and add object to list
  Otherwise grab that tag object and drop into list

Check if posts exists and has already been tweeted

Add the post to the DB

Make post tags into hashtags

Ignore Linkedin

Send post to twitter

Go to sleep for 45 seconds to not get rate limited on twitter API


I created a command line script to post to Twitter using Tweepy and a script to post to Linkedin.  Linkedin's authentication is goofy, so for now I just disabled that and use the free version of Zapier [Thanks Zapier for doing the heavy lifting].

You can find the scripts here. The SQLite DB is just there to keep track of my previous posts, you'd probably want to delete it and create your own if you use the repo.

Have fun