惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
月光博客
月光博客
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
罗磊的独立博客
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
量子位
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队
博客园 - 聂微东
V
V2EX

Matthias Ott

Hello Again, World This, Still Not for Everyone The Shape of Friction WeissKlang L1 – Punching Above Its Weight Continvoucly Morged Value Webspace Invaders To Affinity and Beyond The Mystery of Storytelling Amateurs! Echoes of Connection Linear() Is Not (That) Linear View Transitions: The Smooth Parts Adding AVIF and WebP Support to My Craft CMS Site Challenge Acoustic Room Treatment and Building Sound Panels, Part 1: Planning Play On Overshoot The HTML Output Element Listening Closely Compressed Fluid Typography The Lifeblood of the Web What Could Go Wrong? That’s My Rank Making Space CSS :is() :where() the Magic Happens Visual Regression Testing for External URLs With Playwright Jane Goodall’s Famous Last Words European Tech Alternatives 🇪🇺 Independent Type Foundry Advent Calendar – Day 24: NaN Independent Type Foundry Advent Calendar – Day 23: Typotheque
Syndicating Posts from Your Personal Website to Twitter a...
Matthias Ott · 2022-10-31 · via Matthias Ott

The hellsite has a new king. And so, many are moving from Twitter to other social networks like micro.blog or Mastodon or are at least trying out those other options while waiting how things might develop.

Cross-posting – or not? #

One of the first questions that comes to mind is: how can I post on both Twitter and Mastodon so that I don’t have to post my status updates separately? A good idea and something that can be done in various ways.

There are, however, a few problems that come with cross-posting from one platform to another. For one, it can look a little weird when your posts on one platform obviously look like they have been written for another platform. Your tweets might contain user handles from Mastodon that don’t exist on Twitter or a Mastodon post could contain a “RT” (for retweet) or quoted tweets. This can look like you don’t really care about the people spending time on the other platform. But especially the user handles can be problematic because people might not know what to do with them or why they look so differently.

But even if you are fine with all that, cross-posting doesn’t solve one of the biggest problems when it comes to posting content online: if you post your thoughts into a silo like Twitter, they are, to a certain extent, out of your control. You can delete (or maybe even edit) them, yes. But when a platform goes down, you end up with the problem of having to export and backup your data again.

POSSE #

Wouldn’t it be great to be able to post tweets, toots, or other status updates on your own site first? Especially the more important ones that you want to preserve? At least, your own site will be with you even when Twitter goes away or your account suddenly gets suspended. This is one of the basic principles of the IndieWeb: publish on your own site, syndicate elsewhere. Or short: POSSE.

You can see an example here on my site. I am syndicating all posts of my microblog section to Twitter, micro.blog, and Mastodon.

The first thing you need to do to achieve all this is to create a section on your site that you can use to post short status updates. This microblogging section then needs an RSS feed. Mine is this one, for example. Whenever you post a status, a new item will be added to the feed. And we can then use the feed to send new items to Mastodon, Twitter, or any other platform.

I won’t cover in this post how you can set up an RSS feed for your site. Yet it shouldn’t be that hard to find solutions online for whatever you are using under the hood of your site. And for the sake of brevity, I will also focus on syndicating your posts to Twitter and Mastodon only.

Syndication with IFTTT #

With an RSS feed in place, the next step is now to use a service that will send new feed items to the different platforms. We’ll use IFTTT for that, so you will need at least a free account there. Of course, you could also use Zapier or any other automation tool that you prefer.

Let’s start with how you can set things up for Twitter.

Syndicating to Twitter #

The first step is to create a new Applet:

Screenshot of IFTTT: New Applet

Now, under “If this”, select “Add” to add a trigger and search for and select “RSS Feed”. Select “New feed item”, which creates a trigger that fires every time a new item is added to your feed. Paste in your RSS feed URL and finish this step via the “Create trigger” button.

Screenshot of IFTTT: Create RSS Trigger

Next, we need to define what should happen when the trigger fires. Select “Add” next to “Then that” and search for and select “Twitter”. Select “Post a tweet” or also “Post a tweet with image”. Connect your Twitter account. For the Tweet text, you can use the fields that are available under “Add ingredient”. You can use {{EntryTitle}},{{EntryUrl}}, or {{EntryContent}}, for example.

Screenshot of IFTTT: Post A Tweet

Select continue, rename your applet if you want to, and complete the process with the “finish” button. And you’re done! 🙌

If you have a free account, your applet will only run once every hour or so. But whenever there is a new item, IFTTT will automatically post a tweet for you.

Syndicating to Mastodon #

With Mastodon, setting up syndication is a little bit trickier. That’s simply because there is no built-in integration for Mastodon in IFTTT. Thankfully, I found a helpful article by Kelson Vibber about “How to Post to Mastodon From Anything Using IFTTT”.

You can still post to Mastodon using a feature called Webhooks. IFTTT Webhooks let you create Applets that can make or receive any kind of web request. So first, we need to activate that.

Go to IFTTT Webhooks and activate the feature by clicking on “Connect“ button.

Now we need to make sure IFTTT is allowed to make a request to post stuff. For this, we need to add IFTTT as an application in the settings of your Mastodon account. Go to Preferences > Development/Your Applications (e.g. on mastodon.social you’ll find it here). Add a new application and enter a name for it. Under Application website, you need to add the full URL of your IFTTT Webhook. You’ll find it on the Webhooks Settings page. From the checkboxes below, only select write:statuses.

Screenshot Mastodon Settings: New Application

Now, everything is ready to create our applet. The first step is the same like in the Twitter example. Create a new Applet and add your RSS feed as the trigger. Now comes the juicy part: Select “Add” next to “Then that” and search for “Webhooks”, select it, and then choose “Make a web request”.

Screenshot of IFTTT - Create a Webhook web request

Now you need to add the details of the request to Mastodon.

The “URL” should look like this:

https://mastodon.example.com/api/v1/statuses?access_token=1234567890

Make sure to replace the mastodon.example.com with the domain of your instance’s server! Also replace 1234567890 at the end of the URL with the access token of the application you created in Mastodon in the settings. To find the token, click on the Application and look for “Your access token”.

The “Method” should be POST.

For the “Content Type”, select application/x-www-form-urlencoded.

Ignore “Additional Headers”. For the ”Body” of the Request, use something like

status={{EntryContent}}

You can also add other ingredients like the URL or date of the post. Just make sure to include the status= part so that everything is working properly.

Lastly, select continue, rename your applet if you want to, and complete the process with the “finish” button.

And you’re done again!

Now, whenever you post a status update on your own site, it will show up (after a little delay) on both platforms. 🎉

Screenshot of a successful test toot

~