scheduling toots on mastodon

Last week, I wrote about my first month of Mastodon. This post is about three options for scheduling a Mastodon toot.

Option 1 – scheduler

The scheduler is easy to find. To use it, you go to your mastodon profile and choose “Development”. This lets you get an API key which you use to login and post. However, it doesn’t support images. (My use case involves an image in each toot.) It also didn’t work in Safari, but did in CHhome for me.

Option 2 – write your own

I started doing this. The REST APIs are well documented. There’s a variety of API wrappers for different languages. The Java one hadn’t been updated in four years and the Python one appears to want your password (not just access key), so I decided to stick with REST APIs. I created a GitHub action. First I used curl to test getting the token from a secret and calling a URL Then I played at the command line on uploading files.

name: JeanneTest

"main" branch
 #  push:
 #   branches: [ "main" ]
 # pull_request:
 #   branches: [ "main" ]
 
 #schedule:
 #  - cron: "0 2 * * 1-5"

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:

  build:
    runs-on: ubuntu-latest

    steps:
      - name: REST API test
        env:
             MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
           
        run: |
          curl --header "Authorization: Bearer $MASTODON_ACCESS_TOKEN" -sS https://mastodon.social/api/v1/timelines/home

This all worked. My next step would have been to switch to Python or Perl to call the attachment API, parse it’s JSON and publish the toot. Then add some sort of scheduler logic. I didn’t get that far because I learned about option 3.

Option 3 – Fedilabs

Fedilabs has an app for that. To use it, you login to your instance and get an auth code. (Each time you schedule.) Then you schedule your toots.

The only think I didn’t find intuitive was the alt text. (You have to upload your image and then the option appears.) What’s cool is that nothing is stored. The app uses the Mastodon REST APIs right away. You can even see your scheduled toots on top.

While I could have written my own, this one is better. And it already exists. So I put some money in the tip jar and am happily using.

Bonus – asking OpenGPT for help

I was thinking to have OpenGPT help me write this blog post. I asked “how do i schedule a mastodon post“. Alas:

I’m sorry, but I’m not able to browse the internet, so I’m not able to provide specific instructions on how to schedule a post on Mastodon. However, Mastodon is a social networking service, so you may be able to schedule a post by accessing your account and looking for a scheduling or scheduling option in the settings or composing a new post.

I then clicked “try again” and got the following. That’s probably true on some client. It isn’t the web browser nor the official iOS Mastodon app.

To schedule a post on Mastodon, follow these steps:

  1. Open the Mastodon app on your device and log in to your account.
  2. Click on the “+” button in the bottom right corner to create a new post.
  3. Type your post in the text field and add any photos or videos you want to include.
  4. Click on the “Schedule” button in the bottom left corner of the screen.
  5. A calendar will appear, allowing you to choose the date and time you want your post to be published.
  6. Once you have selected the date and time, click on the “Schedule” button to confirm.
  7. Your post will now be scheduled and will automatically be published at the specified time.