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.
Click on Development > New application:
Application name | changedetection (free to select) |
Application website | http://192,168.1.210:5000 (URL of my instance) |
Redirect URL | urn:ietf:wg:oauth:2.0:oob |
Scopes | read: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
.
Get the RSS feed and get the latest title and link with xpath
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><p>In <a href="http://localhost:1313/posts/2024/changedetection/">the last blogpost</a>
I showed how I use a instance of changedetection.io on a Rasperry Pi to monitor and track changes in a Service Now portal.</p>
<p>In the meantime I tweaked this a bit more and found a way how I can monitor the <a href="https://stoeps.de/index.xml" target="_blank">RSS Feed <i class="las la-external-link-alt la-xs"></i></a>
of my blog to post a toot on mastodon when I created a new blog post.</p></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.
The steps “Browser Steps” and “Visual Filter Selector” can be ignored.
In “Filters & Triggers” add the xpath selection:
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.
- Access token
- The mastodon instance
visibility
(you can also use direct to include just some users){{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:
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.
Do not spam your mastodon instance! For testing you can send the toot directly just to your own user!