Wednesday, January 25, 2023

Using IFTTT Webhooks to post RSS feed data to Mastodon (requires pro account)

Update 2/19/2024: I did this using my free IFTT account but per IFTT "Starting February 15th, 2024, webhooks Applets will be disconnected for free users". Currently a subscription is $35 a year but of course that may go up.

------------ original --------------

Eleven years ago I wrote about using the IFTTT service to create tweets from the RSS feed of my Pinboard shares (which are written for myself and for Emily; there are now over 49,000 entries).  

Back then I was continuing a kind of sharing I started with Google Reader Social (details) and continued with App.net after Social died.

Now Twitter is dying, but, incredibly, Maciej Ceglowski's Pinboard endures. I've migrated to Mastodon (on an instance for veterans of App.net!) so now I use IFTTT (still free for my use) to create mastodon posts tagged #jgshare from that old Pinboard RSS.

I'm writing now to share a bit of how that works. I started with a recipe first published in 2017 and updated in 2022 by KelsonV. That recipe uses IFTTT web hooks: I tweaked it a bit to get the output I wanted:

    Descriptive Title

    URL

    Commentary

The recipe is a bit hard to follow but the key steps are:

  1. In Mastodon Profile Preferences Development create an "application" with website "https://ifttt.com/" and Scope of write:statuses. After it's created copy the access token.
  2. In IFTTT create a rule based on the RSS feed of your source (in my case Pinboard shares with a particular tag). My rule starts with IF "New Feed Item"
  3. The action part of the rule is a web request"
    1. URL: https://appdot.net/api/v1/statuses
    2. Method: POST
    3. Content type: application/x-www-form-urlencoded
    4. Authorization: Bearer 1234567890 (replace 1234... with your Mastodon access token)
    5. Body as below.
KelsonV's post has additional details and screenshots.

The trick in the body was to get line spaces between Title, URL and Commentary. This worked:
status = 
<<<{{EntryTitle}}
>>>
<<<{{EntryUrl}}
>>>
<<<{{EntryContent}}
>>>
#jgshare
When I first ran this I'd get errors in my IFTTT log but the rule worked successfully. The errors went away.

No comments: