Tag Archives: Pocket

How to Post to Mastodon From Anything Using IFTTT

I finally managed to hook up IFTTT to Mastodon to auto-post from another site! I use IFTTT as glue for linking several services together including sharing interesting links from Pocket when I’m offline: I can add a tag in the app on my tablet, and then when it syncs that tag up to the cloud, IFTTT will pick it up and create the share post on whichever service I’ve tagged it for.*

My main source was this post by @raucao@kosmos.social. It’s a bit out of date, but it pointed me in the right direction.

1. Set up IFTTT’s Maker WebHooks

On IFTTT, go to maker_webhooks settings. Make sure it’s active.

2. Set up Mastodon to allow IFTTT as an application

Go to Preferences/Development/Your Applications on your Mastodon instance (ex: on mastodon.social it’s here). Click on New Application. Enter the following:

Website: https://maker.ifttt.com/ (at first I thought you needed the full URL from the IFTTT config, but it seems OK without it.
Scopes: read and write should be enough. Actually just write might be fine.

Submit the app.

Now open the new app you’ve created and look up the access token.

3. Create an IFTTT app!

Go back to IFTTT and create a new app. For example, I created an app triggered by Pocket, whenever an item is tagged share-mastodon. You could also set it up to autopost every time you blog with a specific tag, or every new item in an RSS feed, or all kinds of things. Even cross-post from Facebook or “the birdsite” (Twitter).

For the “then that” section, choose a Webhooks action.

URL: https://mastodon.social/api/v1/statuses?access_token=1234567890 (paste your access token here.)
Method: POST
Content Type: application/x-www-form-urlencoded
Body: status=whatever-you-want-to-post

For example, to share a link from Pocket you might want the body to be

status=<<<{{Title}}>>> <<<{{Url}}>>>

Or for posting from WordPress, you might want it to be

status=New blog post: <<<{{PostTitle}}>>>

Click on Create Action.

Add a title and click on Finish.

4. Test it out!

Go and post something that should trigger the rule, then come back and click “Check Now” on the IFTTT applet. Make sure it comes through the way you want it to. Adjust it as needed.

Update (Feb 2018): This method can’t upload images, because the Mastodon API needs the image to be uploaded before you post the status, and IFTTT apps can only take one action. If you want to cross-post between Twitter and Mastodon, you can use crossposter.masto.donte.com.br, which can handle image uploads. @outside_rs confirmed that you can use Twitter+Crossposter as intermediaries to get images from another service onto Mastadon, as in Instagram→ IFTTT→ Twitter→ Crossposter→ Mastodon. It’s roundabout, but it works! (Not sure when I’ll have time, but I’m thinking about writing a gateway script that you can hit directly from IFTTT that will upload an image and then post to Mastodon with it, removing the dependency on Twitter.)

Update (March 2018): You need to watch out for ampersands and single quotes when doing this, because the API handler treats them as separators. Wrapping the ingredient like this <<<{{Title}}>>> should fix it.

You can follow me on Mastodon at @kelsonv@mastodon.social. If you’re not on Mastodon, but would like to check it out, start at JoinMastodon.org. It’s a quick overview of what Mastodon is, how it’s different from Twitter, how different instances work (think of them as different servers on an MMO game, or different email services), and how to pick an instance that suits you.

*The day after testing the Pocket-to-Mastodon connection with a few links, I discovered something interesting about IFTTT when it re-posted one of those links to Buffer. Apparently IFTTT doesn’t know which tags are new, only which bookmarks have been updated and what the current tags are. My new Pocket-to-Mastodon applet picked up the share-mastodon tag I’d just added, and my Pocket-to-Buffer applet picked up the old share-buffer tag that had been on there since I first shared it last month.

Pocket Goodness and Speech Oddities

I’ve been using Pocket lately to offload “Hey, this looks interesting” articles from times when I really should be doing something else to times when I have, well, time.

  • It syncs a copy of the article to each mobile device, which means I can see something in the morning, save it to Pocket, then read it on my tablet at lunch.
  • Feedly talks to it easily. I’ve even linked it up with IFTTT so that tapping “Save for Later” on the tablet will add an article to Pocket.
  • Speaking of IFTTT, I’ve also set it up so that saving an article as a favorite in Pocket also adds it to Delicious.
  • The Android app will accept shares even if there’s no network connection, then sync up when it’s online. That means I can look over a newsletter in Gmail at lunch, save the links that look interesting, and archive the email. Then I can read the article at work or at home…or the next time I’m out somewhere, after it’s synced.

I’ve also started using the text-to-speech feature to listen to articles in the car while driving to and from work. The voice is fairly decent despite the usual flat tones and lack of natural rhythms, but there are a few oddities that take getting used to.

  • # is always read as “hash.” This makes it really odd for comics articles, which frequently talk about issue numbers. “Batman Hash 123” just sounds wrong.
  • Italics are…always…emphasis, and presented by…pausing…rather than changing tone. This makes it…awkward…for anything involving lots of titles.
  • It parses words, rather than using a dictionary, and can’t always figure out whether initials should be read individually or pronounced as a word. This usually works fine, but occasionally leads to phrases like “tah-kay-down notice,” “link-uh-din” or “pohs terminal.” On the other hand, it figured out “I-triple-E,” so I imagine it’s got a dictionary for special cases.