Creating bot on discourse

Is there a way to create a bot on Discourse that would reply to my commands, in a similar way that I have built many of my Discord bots?

Basically, I know that there are various plugins that I can install, but in my mind, it would be far easier for me to maintain if I could just have a bot that could listen to the text in a comment rather than trying to install plugins that are prone to mess up with things and especially if the maintainer decides that they don’t want to maintain the plugin anymore.

You are going to need a plugin.

Take a look at my Frotz plugin as an example/starting point

API only plugins like this tend to be more stable over time so don’t worry about instability. All code requires maintenance in any case. I’ve done minimal changes to Frotz-bot over time.

Take a look at my Discord bot plugin to see how you can write code against events like new posts:

Your needs might be met by:

If you want more control over the code’s destiny, maintain a fork/repo yourself.


If you really want it to be entirely separate, you could use a combination of webhooks to deliver events to your bot and the HTTP requests API to have your bot make changes in Discourse.

Discourse API Docs

As @merefield alludes to though, it is possible to create plugins that do not override core functionality, instead being notified for events and interacting with core APIs, which are easier to maintain and less likely to have unwanted side effects.

Going the webhook/API route also requires setting up a stack to run your bot and ensuring that it is always available while Discourse is available, both of which come for free with a plugin loaded into Discourse.

Writing a plugin would require learning Ruby and gaining some familiarity with Discourse classes but if you’re already capable of writing and maintaining a bot in something else, I’m sure you could learn what’s needed pretty quickly.


Ah yes, that too, good point Simon!

Thank you everyone for your suggestions — I will definitely take look at all of them. :smiley: