Notifications for busypub

TL;DR

Where busypub gets automatic notification capabilities.

In ETOOBUSY automated publishing we met busypub, a little Perl program to automate publishing blog posts that were writte beforehand.

It just happens that every time I publish a new post here, I also announce it in Mastodon and Twitter.

So, it should not come as a surprise that the following posts (namely, Post status on Mastodon, its follow-up Post status on Mastodon - with Mojo::UserAgent, and its counterpart Post status on Twitter) looked into posting status updates on these two microblogging platforms.

So there you have it: as of commit 53b31bd, busypub got notification capabilities. As it’s meant to be used in Dokku, the configuration is passed through the environment, in particular it relies upon RECIPIENTS and LAST_URI.

The first - RECIPIENTS - is a JSON-encoded array of hashes that allow passing configurations specific to the two platforms, like this:

[
  {
    "type": "mastodon",
    "uri": "https://octodon.social/api/v1/statuses",
    "token": "yadda-yadda-yadda",
    "visibility": "public"
  },
  {
    "type": "twitter",
    "api_key": "yadda",
    "api_secret_key": "yadda-yadda",
    "access_token": "yadda-yadda-yadda",
    "access_token_secret": "yadda-yadda-yadda-yadda"
  }
]

The second - LAST_URI - is the URI of where the announcement can be found. This is an example of what it expects to find at some location in the blog:

2020-05-30
Post status on Mastodon https://github.polettix.it/ETOOBUSY/2020/05/30/mastodon-post-status/ #mastodon #octodon #perl #coding

Initial and final spaces in the whole string are trimmed away automatically.


Comments? Octodon, , GitHub, Reddit, or drop me a line!