Slack Bot Construction Kit 🤖

Summary: it’s a Slack Bot integration construction kit.

This is meant to provide a foundation to build a rich(er!) bot that can integrate with your Discourse and allow you to write simple Ruby to control your bot.

It is somewhat experimental at this stage!

If you want me to help you write a rich bot for a specific purpose, you can hire me, otherwise fork and have a go!

NB There is an official tool for basic integration with Slack chat: Chatroom Integration Plugin (discourse-chat-integration). If you needs are met by this plugin, use it, it is officially supported by the core team. The focus of this plugin is meant to provide a platform for building a bespoke bot.

:link: GitHub: GitHub - merefield/discourse-slack-bot: Get your Discourse to run a bot on Slack and use it to integrate the two systems https://github.com/merefield/discourse-slack-bot
:arrow_right: Install: Follow the plugin installation guide.

Features

Similar, if less developed, than my Discord Bot, it provides some out-of-the-box functionality.

At present this is limited to:

  • chat sync - copies chat from Slack to a Topic in Discourse
  • a command to copy chat history to Discourse (@botname copyhist <number of messages>)

Configuration

Settings are straight forward:

You also need to set up Open ID Connect to work with Slack:

Please NB:

  • This uses simpler to set up Slack Classic Bot (permissions are really simple)

TODO

Curently it only supports Classic Slack Bots. The reason for this is that it leverages existing Gem API libraries that only fully support Classic Bots at this stage in the way needed to integrate with Discourse. Migration to the newer style of bots will require significant work on the Gem API which was not a focus of this MVP. At some far out date in the future, classic bots will be retired. Hopefully we’ll get around to work on the API ahead of that time, especially if there is interest.

Credits:

Discourse team provided funding for this MVP, thank you! :pray: @erlend_sh , @markvanlan @david

9 Likes

I plan to have a go at this on Wednesday, what I want to achieve is the following:

  • Slack update when a user posts for the first time
  • Slack update when a topic has not had a reply for a set time

First of all are these doable and if so do you have anything to reference to help me achieve this?

Thanks Joe :slight_smile:

1 Like

Joe, I don’t have the bandwidth to assess that outside of a contract, but I can’t imagine that will be too difficult.

Just one thing to note: that’s going the opposite direction to what is currently implemented, just bare that in mind.

Hopefully the authentication method and basic API has not changed since this was built.

I definitely would accept a PR for those additions.

If you end up finding it too tricky I would consider a contract to implement it on your behalf. Contact me via PM if that ends up being the case.

Best of luck!