How to Automatically Post your Tweets to Mastodon

Over the last several weeks, I’ve gotten in the habit of trying to move all of my Twitter activity over to Mastodon instead. I signed up for Mastodon several years ago, but only now are there enough people using it for it to replace a lot of what you might use Twitter for. Some of your friends are there, some of your favorite bots are there, and some news sources are there. What more do you need in life, really?

I’ve been using Pinafore (along with a user stylesheet I created… feel free to grab it for yourself) to use Mastodon on the web, and a combination of Ivory and Metatext on my iPhone. Ivory looks a bit nicer but Metatext has a Notifications tab that acts more you’re used to it working on Twitter.

If you want to move all of your activity over wholesale, go to town. If, however, you want to keep publishing Tweets on Twitter and have them automatically publish to your Mastodon account as well, this short guide is for you. The entire process should take around five minutes. It’s mostly just clicking around on a couple of websites.

Important: If you do this, the goal should not be just replicate your Tweets and never visit or engage on Mastodon. The goal should be to help you build your Mastodon presence and save you from having to manually double-post. Ideally you quickly get to the point where Mastodon becomes your primary crib.

Step 1: Open a Mastodon account

If you’ve already done this, great. If you haven’t, head to any server you want — like mastodon.social, for instance — and set up your account. You can always switch your server (along with any followers you accrue) later, so don’t stress about the server you choose.

Step 2: Open an IFTTT account

IFTTT (“If This Then That”) is a freemium service that lets you automate things on the internet. You can use the free account for now. The only difference for our purposes is that the free account will only poll your Twitter account for new Tweets once an hour. This is only a problem if you Tweet a lot per hour because they will all get posted to Mastodon in batches, once an hour. If this becomes a problem, you can always upgrade to the paid version for two bucks a month. For now, head over to IFTTT.com and set up a free account for yourself.

Step 3: Get your Mastodon posting URL

Head over to your Mastodon account on the web and choose “Preferences” in the lower right corner. Then choose “Development” at the bottom of the left navigation. Then choose “New Application” in the upper right. Under “Application Name”, type in whatever you want… something like IFTTT. Under “Application website”, type in https://ifttt.com. Leave the “Redirect URI” field alone, and make sure *only* the write:statuses box is checked. Hit the Submit button at the bottom of the screen, and then click the name of your application (e.g. IFTTT) on the resulting screen. Now open a new tab in your browser, leaving this page available for later.

Step 4 (Final step!): Connect your IFTTT account to your Twitter and your Mastodon accounts

Head back over to IFTTT.com and hit the “Create” button in the upper right. Click the big “If This” button, search for “Twitter”, and then click it. Scroll down and choose “New Tweet by a specific user”. Choose your own Twitter account and IFTTT will perform the necessary authorization. Then, type the username to monitor (in this case, your own), and hit “Create Trigger”. Now click “Then That” and search for “Webhook”. There should be a tile on the resulting page that says “Make a web request”. Click that. You’re almost done. For the fields, enter the following:

URL:
https://mastodon.social/api/v1/statuses (replace “mastodon.social” if you chose a different server above)

Method:
POST

Content Type:
application/x-www-form-urlencoded

Additional Headers:
Authorization: Bearer AccessToken (replace the word “AccessToken” with the access token from the one on the Mastodon page you left open above)

Body:
status={{Text}} (Everything inside those brackets is the content of the Tweet… you could prepend some custom text right after the equals sign if you wanted)

Now hit the big “Create Action” button, then the “Continue” button, then the “Finish” button, and BOOM, you’re done!

The next time you Tweet, within an hour, it should appear on Mastodon. If you upgrade your IFTTT account, it should lag by only a few minutes.

I encourage you to move your primary posting and reading activity over to Mastodon, but this is a good baby step if you’re not quite ready for that yet. It’s also a great way to set up news bots. We need more of those. You can follow the Axios newsbot I created here, or you can follow me on Mastodon here.

9 comments on “How to Automatically Post your Tweets to Mastodon”. Leave your own?
  1. Les Orchard says:

    “If you want to move all of your activity over wholesale, go to town. If, however, you want to keep publishing Tweets on Twitter and have them automatically publish to your Mastodon account as well, this short guide is for you.”

    For what it’s worth, a few Mastodon instances are starting to regard cross-posting from Twitter as a potential abuse vector and a sign of spammy bot behavior. Your mileage will vary, but you may find yourself muted or limited in some cases. Especially if you cross-post and then ignore interactions over on Mastodon.

  2. Mike D. says:

    Good to know! Probably varies on a server-by-server basis as well as how you’re using this functionality (high volume/low volume etc) but a good thing to keep an eye on. My own view — which may not be shared by everyone — is that compelling content is what’s most needed right now. You don’t want people giving Mastodon a shot and immediately thinking “where is everybody?”

  3. Jonathan Green says:

    Thanks. Followed your instructions carefully and created activity OK but sadly when it fires I get…

    Action failure message
    Incorrectly formatted headers

    …at the Webhooks writing stage.

    Any tips?

  4. Jonathan Green says:

    Ah. Well, if I had actually FOLLOWED your instructions(!) I might have had more luck. I missed out the “Authorization: ” bit. Works.

    Thanks

  5. Al says:

    :( aus.social seems to reject the IFTTT posts. Can’t use mastodon.social as the server isn’t available in Australia. Might try it again later, if I can find another suitable server.

  6. Ttown says:

    @AI — Each one of the Mastodon servers is separately maintained. If aus.social is rejecting your posts, you might contact that admin and see what’s up. It may be intentional that the api is disabled, or maybe the server software needs an update.

    @Les Orchard — I’m on mstdn.social and you hit the bulls-eye. Lot’s of folks here are pretty skeptical of twitter cross-posters.

  7. david koff says:

    This only partially works for me. For some reason, on Medium’s mastodon instance (me.dm) my tweets are re-posted, but they are all cut off after about half a sentence. I’d show pics, but, can’t do that here.

    So it seems like the fundamental stuff is working with the connections, but the issue of grabbing the ENTIRE tweet is broken. Curious if others have a solution.

  8. Chad McCoy says:

    No longer free, must have paid account to do this at all with Twitter

  9. Kirsten says:

    ‘New Tweet by a specific user’ is the end of the line for me: it’s a PRO option on IFTTT, you have to get a subscription in order to be able to use it. :(
    No workaround or other site/app available?

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe by Email

... or use RSS