Auto-Posting to Mastodon via IFTTT
Posted on by Bob Matyas
In the past, auto-posting to Twitter was an easy low-effort way to increase the visibility of content published on your own website. However, in recent months, Twitter has turned off this capability by restricting access to its API.
This â along with the general way in which Twitter has been declining since Elon Muskâs purchase â has prompted many to either abandon Twitter altogether or supplement their Twitter usage by joining Mastodon. If you previously auto-posted content to Twitter, auto-posting to Mastodon can be a way to increase traffic to your site.
Depending on the platform you use, there are different ways to do this. For example, if you run WordPress, you could add a plugin to handle auto-posting to Mastodon. However, you can also do this taking your siteâs RSS feed and using it to auto-post to Mastodon via the automation tool IFTTT (If This Then That). This doesnât require any code or additional dependencies and works with any publishing platform that uses RSS.
Create an App on Mastodon
- Go to âSettings > Developmentâ
- Click on âAdd an Appâ
- Give the app a name, i.e. âRSS to Mastodonâ
- Under âScopesâ remove the default global permissions and add âwrite:statusesâ
- Click âSaveâ
You will then have a new app with client key, client secret, and an access token. You will need the access token in the next section, so keep the window open.
Create an App on IFTTT.com
- Go to âCreateâ an applet
- Click âAddâ on âIf Thisâ and under âChoose a Serviceâ search for âRSS Feedâ and click on that
- On the next screen â âChoose a Triggerâ â select âNew Feed Itemâ
- Add the address of the RSS feed you want to auto-post from to the âFeed URLâ field.
- Once you do that click âAddâ next to âThen Thatâ
- Search for âwebhooksâ and click on that
- Select âMake a Web Requestâ and click on âConnectâ on the next screen
- On the âComplete Action Fieldsâ screen, add the address:
https://INSTANCE_URL_HERE/api/v1/statuses
and replaceINSTANCE_URL_HERE
with the address of your instance, i.e., mastodon.online - For the âMethodâ, select âPostâ
- For the âContent Typeâ, select
application/x-www-form-URLencoded
- For the âAdditional Headersâ field, add
Authorization: Bearer YOUR_MASTODON_ACCESS_TOKEN
and replaceYOUR_MASTODON_ACCESS_TOKEN
with the access token that you created in the first half of the instructions - For the âBodyâ field, add
status={{EntryTitle}} {{EntryUrl}}
- Click âCreate Actionâ
- On the next screen, click âContinueâ
- Edit the âApplet Titleâ to be something descriptive like âRSS to Mastodonâ
- I recommend turning on âReceive notifications when applet runsâ
- Click âFinishâ
Now, next time you publish to your website, your Mastodon account will automatically post a link to your new post.