Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

mastodon elephant toot empty


Every time I create a new post in this blog I like to toot or tweet about it. Instead of manually doing this, I have my Mac Mini run this shell script on a cron job, which does it automatically for me.

The way it works is pretty simple:

  • Download my latest blog feed as a json file.
  • Check for any new blog posts.
  • Compares with a local CSV file that records previous toots.
  • Posts new toots to Mastodon.

This is used by to auto post new blog posts to his Mastodon.

How to run:

This script is written in Kotlin and can be run from anyone's command line

brew install kotlin
kotlin tootbot.main.kts

Script variables:

1. Mastodon instance name

Should be obvious

val mastodonInstance = ""
//val mastodonInstance = ""

2. Mastodon Token

Head on over to your Mastodon Profile -> Developer settings page and create an application. After creating a new application you should find "Your access token".

// Settings page link:

3. Json feed url

Your blog should make available a json feed which the script will automatically download and parse for new blog posts. If you use Hugo my blog theme Henry has a template you can use.

val jsonFeedUrl = "https://your-blog/feed.json"

4. Previously tooted

After posting a toot to Mastodon, this script will write the status to a CSV file locally called "toots.csv". It simply jots a map of your blog post id and the Mastodon status number.

It additionally also uses this file to prevent duplicate tooting of the same blog post. So remember to not clear this file, if you've started using this script.

val tootsFile = "./toots.csv".toPath()

5. Force a toot

There are times I want to forcefully toot a blog post that otherwise wouldn't get picked up by the script (e.g. a blog post posted before today). For these cases I like adding the blog post id in this variable, which will make sure to toot the blog post anyway.

val forceToot = listOf(

How I use it:

For now, I run this script on a cron job from command line, on a Mac mini server that I use. I could dockerize it and make it even more easy but this works for me and is pretty simple, so no current plans for that.



🐘 auto-toot bot to Mastodon. Parses a Json blog feed and posts to Mastodon saving status to a csv file.







No releases published


No packages published