Skip to main content

Toot new blogposts with changedetection.io

·544 words·3 mins

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 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.

20240913-171833.png

Get the RSS feed and get the latest title and link with xpath #

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.

Note

Do not spam your mastodon instance! For testing you can send the toot directly just to your own user!

Christoph Stoettner
Author
Christoph Stoettner
I work at Vegard IT GmbH as a senior consultant, focusing on collaboration software, Kubernetes, security, and automation. I primarily work with HCL Connections, WebSphere Application Server, Kubernetes, Ansible, Terraform, and Linux. My daily work occasionally leads to technical talks and blog articles, which I share here more or less regularly.

Related

Windows change display resolution with one click

·215 words·2 mins
I spend the entire day working on a very sizable 4k UHD display, and I frequently ran into the problem of wanting to share my screen with participants in various collaboration tools. Then, viewers claim that my screen is too small on the remote displays due to the display resolution of 3840x2160 pixels.