Mastobot: For your Fediverse PHP posting needs

in PHP2 years ago

Like much of the world I've been working to migrate off of Twitter to Mastodon and the rest of the Fediverse. Along with a new network is the need for new automation tools, and I've taken this opportunity to scratch my own itch and finally build an auto-posting bot for my own needs. And it is, of course, available as Free Software.

Announcing Mastobot! Your PHP-based Mastodon auto-poster.

Different strategies

Mastobot runs on cron, and can post prepared status messages in either random order or in sequence. It's also set up to support additional posting strategies as they are developed.

It currently cannot handle responding to messages; that would require it to accept incoming federated posts, which is a whole other problem space. (Though I'm toying with that as well.) For now, Mastobot is just a blind poster.

Many formats

You can define posts for Mastobot in Text, JSON, or YAML format, depending on what post settings you want. It supports multi-lingual posts, and all post visibilities, as well as content warnings/spoiler text. See the documentation in the README for more details.

(Please respect your server's rules.)

See it in action

I already have two instances set up on my own Mastobot instance. One is configured to periodically post links to some of my old articles, or links to my book, Thinking Functionally in PHP, to my main Mastodon account on PHPC.social.

The second is a just-for-fun account, @TOSSynopsis. Inspired by the famous @TNGSynopsis Twitter account, it's amusing summaries of Star Trek: The Original Series episodes.

I have a few other auto-poster accounts I have planned, which now that the bot exists are trivial to setup. Just edit a YAMl file, put a bunch of text files in a directory, and you're good to go.

PRs welcome!

The one main feature that isn't support yet is posting media along with the message. The underlying Mastodon library I'm using, colorfield/mastodon-api, doesn't have a clear API for doing so. Unfortunately, the state of Mastodon client libraries in PHP is not great right now. If we can figure out a good way to support attached media, I'm open to adding support or will accept PRs for the same.

Mastobot is AGPLv3 licensed, so everyone is free to run it for any account on any server. At the moment it's in 0.3 status; I don't have any breaking changes planned, but some feature requests may necessitate some. Consider it a beta release at the moment; usable with a bit of caution.

Happy Tooting!

Sort:  

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support. 
 

🍕 PIZZA !
@crell! The Hive.Pizza team manually upvoted your post.

Please vote for pizza.witness!