Azuracast Webhook for Mastodon

While I have been moving house to Mastodon over the past month, I knew I would be missing the ds106radio tweets announcing someone going live. That bot was created by UMW student Aaron Clemmer in Sping of 2011, and has been doing its thing for more than 10 years with 134,000 tweets since.

ds106radio twitter profile

ds106radio twitter profile

In 2020 when we moved ds106radio to Azuracast, Tim did some surgery on the bot to keep it working with the new application (we were previously using Airtime). The bot notifies Twitter whenever someone goes live or plays a new track is played, but the trick is it only needs to send notifications when someone is broadcasting live. When no one is live the station falls back to WFMU and none of that is sent as a notification—if it did it would be a very loud account. Yet another functional relic from the most awesome course ever!

To be clear about the details of Tim’s intervention mentioned above, the web hooks available in Azuracast integrate with Twitter and post whenever a new song is played or a new DJ goes live. The issue for us with that is it posts everything, not only when a DJ goes live on ds106radio, but also all songs and DJs when the stream defaults back to WFMU. As mentioned before, that would be way too noisy. So Tim wrote a script that bypasses the Twitter web hook and call a PHP file that has code that only posts to Twitter when someone goes live and when a new song plays—everything else is muted. That works great for Twitter, but what about Mastodon?

Image of webhook interface in Azuracast

Webhook interface in Azuracast

I looked at Tim’s code, but not only was that for Twitter, but I am not a programmer so even if it did translate there’s no way I could do anything with it. At the same time I noticed the lead developer of Azuracast, Buster Neece, announced they built-in web hook support for Mastodon. I checked that new feature out by upgrading to the latest release candidate, but it was not full featured yet. So, given this is an open source app and Azuracast has a Discord community I reached out to see if this was in development and if the ds106radio community could help fund it, literally within days the web hook for Mastodon not only had all the features we needed (namely posting only when a DJ goes live and the metadata changes for a live stream). But even cooler, the Twitter web hook that existed for Azuracast also got these new features, making Tim’s script to no longer necessary. So good!

"Live only" option for both Mastodon and Twitter webhook in Azuracast

“Live only” option for both Mastodon and Twitter web hook in Azuracast

The Azuracast web interface makes it easy to integrate with Mastodon, and you can customize the messages that go out pretty seamlessly.

Web Hook for Mastodon

So now I integrate Azuracast with the Mastodon account for @ds106radio on the social.ds106.us server and I am once again in tune with the mighty ds106radio!

This entry was posted in ds106radio, ds106social and tagged , , , , , , , . Bookmark the permalink.

1 Response to Azuracast Webhook for Mastodon

  1. Pingback: Defaulting to the Cloud | bavatuesdays

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.