Toot new blogposts with changedetection.io

Created:
Author: Christoph Stoettner
Read in about 3 min · 540 words

A 3D render of the Mastodon logo

Photo by Chethan | Unsplash

In the last blogpost I showed how I use an instance of changedetection.io on a Raspberry Pi to monitor and track changes in a ServiceNow portal.

Meanwhile, I tweaked this a bit more and found a way how I can monitor the RSS Feed of my blog to post a toot on mastodon when I created a new blog post.

Here are the steps to get the information from the RSS feed. I run this once or twice a day and just grep the latest entry of the RSS feed because I normally do not post more than once a week. So this should be fine for my personal blog.

Add mastodon notification

First we have to register a new application in the Mastodon instance.

20240913-170856.png

Click on Development > New application:

Application namechangedetection (free to select)
Application websitehttp://192,168.1.210:5000 (URL of my instance)
Redirect URLurn:ietf:wg:oauth:2.0:oob
Scopesread:accounts, write:media, write:statuses

More details can be found here.

Save the document and open it again, Mastodon present you Client key, Client secret and Your access token. For Apprise you need the access token.

20240913-171833.png

20240913-164543.png

The RSS feed looks like this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Have you closed all Windows - stories from stoeps on stoeps</title>
    ...
    <item>
      <title>Toot new blogposts with changedetection.io</title>
      <link>http://localhost:1313/posts/2024/toot-new-blogposts/</link>
      <pubDate>Fri, 13 Sep 2024 16:00:00 +0200</pubDate>
      <guid>http://localhost:1313/posts/2024/toot-new-blogposts/</guid>
      <description>&lt;p&gt;In &lt;a href=&#34;http://localhost:1313/posts/2024/changedetection/&#34;&gt;the last blogpost&lt;/a&gt;
 I showed how I use a instance of changedetection.io on a Rasperry Pi to monitor and track changes in a Service Now portal.&lt;/p&gt;
&lt;p&gt;In the meantime I tweaked this a bit more and found a way how I can monitor the &lt;a href=&#34;https://stoeps.de/index.xml&#34; target=&#34;_blank&#34;&gt;RSS Feed &lt;i class=&#34;las la-external-link-alt la-xs&#34;&gt;&lt;/i&gt;&lt;/a&gt;
 of my blog to post a toot on mastodon when I created a new blog post.&lt;/p&gt;</description>
    </item>
    <item>
    ...

I want to create a toot with the post title, link and summary (description). Using the Basic fast Plaintext/HTTP Client is sufficient here.

20240913-170047.png

The steps “Browser Steps” and “Visual Filter Selector” can be ignored.

In “Filters & Triggers” add the xpath selection:

20240913-170245.png

I use concat here, to combine the three fields in the toot.

This selects title, link and description of the newest blog post in the feed. Additionally I start the post with “OMB: New article”.

xpath:concat('New article "', //item[1]/title,'" published ', //item[1]/link/text(), '. ', //item[1]/description/text())

Enable a mastodon app in changedetection notification

I want to use Mastodon just for one entry in Changedetection, so I keep mail notification in my default settings and change notification only for this single entry.

20240913-172256.png

  1. Access token
  2. The mastodon instance
  3. visibility (you can also use direct to include just some users)
  4. {{current_snapshot}}

{{current_snapshot}} is important, because this contains the output of our xpath from above. I have changed the title of the notification to OMB: now, this appears at the top of the toot.

For the last blog post this notification looks like this:

20240913-173144.png

Hope this helps with your notifications, the options of Apprise are really awesome and you can post to any chat app or use ntfy to get an update directly on your mobile.

Author