Making a Mastodon Bot Account & Integrating with *arrs

I want a bot account to run on Mastodon, and I want it to be private, so only I can follow it and see what it posts. I have one on twitter, and the apps I’m using to post to the account (sonarr, radarr, etc) have Twitter integration, so posting to the account is easy. With Mastodon, they don’t have notification integration. They do have the ability to run a custom script though. Mastodon accounts also don’t have a one-click private button like Twitter does, but again, that can be worked around. Below are the steps I took to get it working.

  1. Create an account. This is the same as any Mastodon account. Make sure you are on an instance that allows bot accounts. There’s the very popular instance, which was made just for bots, but anywhere works (as long as it’s allowed).

  2. Protect the account. There’s an excellent article here on Nerds Chalk that covers how to lock down your account, so I won’t rewrite it all. Do all the steps there.

  3. Mark your account as a bot account in Settings->Profile->Appearance:

  4. Go to Settings->Development->New Application, then fill out the name and check only the “write:statuses” box. Make sure all the others are unchecked.

  5. Once you have the application created, you can click on it to get all its secret details (key/secret/token). You likely only need the access token.

  6. Download/clone the script from my github repo. All you need is the .sh script.

    • This script is completely optional. You may have something that works better for you. If so, use that and forget the rest of this post.
  7. Put the script somewhere that the *arr apps can access it. Modify it and put in your token (TOKEN variable at the top) and domain (DOMAIN).

  8. In each of the apps, set up a “Custom Script” connection that runs the script.

  9. Click Test and look at your Mastodon account. There should be a test message there. If not, look at the logs to see why there isn’t. You might need to modify the script again and fix paths.

  10. See the README on the github repo for information about customising output. It has links to proper documentation for each app, showing what fields you can use for the output.