James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Live, Love, Bike, and Code

Share


Tags


Automate Posting to Mastodon via Web Requests

One of my favorite applications that I use for automation is If This Then That aka IFTTT. I have been using it forever and it allows you to automate a plethora of things when something happens. For example, maybe you want ot create a spreadsheet of every favorited tweet you have, or maybe save them to a list somewhere, or maybe automatically turn on your lights at sunset. All of this is possible with IFTTT and is crazy easy to use with connectors. I often have automation setup on RSS feeds or my YouTube feed when I post something that it automatically Tweets it out and posts it to a Discord channel:

There are all sorts of built in connectors such as Twitter, which makes it really easy to setup automation. However, services such as Discord and Mastodon don't have these integrations.... they do however have an API that you can call through the web request feature of IFTTT. So, let's get started!

Get your API key

Head over to your Mastodon server, go to settings, and then Development. For example, this is what the URL looks like on mastodon.social: https://mastodon.social/settings/applications

Create a New application and set the following:

Once create you will get 3 different keys. The one that you want is Your access token. Copy this as you will need this soon.

Create your webhook in IFTTT

When you setup your IFTTT, you will want to have it trigger by something, in my instance I posted on my rss. Then choose a "that" which is "Webhooks".

Enter the following:

Make sure to update mastodon.social with your server name and also put your API key in there ;)

Here is what my Body looks like for my blog

status=Just posted a new blog: {{EntryTitle}} - {{EntryUrl}}

Test it out!

You did it!!!! Mission successful!!!

Copyright © James Montemagno 2022 All rights reserved. Privacy Policy

View Comments