Rasa Mattermost Direct messageing


I am trying to integrate a Rasa bot with Mattermost

So far I have been successful in setting up an integration as described here (Mattermost) but this means that I have to use a trigger word for every message to the bot which quickly becomes quite annoying.

Ideally, I would like to trigger it once and not have to do it again.

Another, better option would be to set up direct messaging with the bot account itself

Has anyone done this previously? Is it possible at all?

I don’t think there is a straightforward solution to this, as outgoing webhooks are only supported in public channels. That makes it tricky to set up a bot for direct messaging.

In private channels / direct messages, you can use Slash Commands instead, but the slash command has to be used in every individual message, too, then. So that’s not better than sending a trigger every time.

To make it work for direct messages, I think you’ll have to implement your own InputChannel that doesn’t rely on an outgoing webhook, instead of using the MattermostInput from Rasa Open Source. Your input channel could directly use the API to read posts in a direct message channel. And the beginning of such a conversation could be triggered by a slash command.

1 Like

Hi Christina,

thanks for the reply. I will experiment with this suggestion and see what comes out of it. I will post any good results here if I have them or follow up with more questions if you do not mind

Sure! I have never integrated a bot with Mattermost myself, was just reading through their developer’s documentation. But I can try to help with questions that come up.

Hi Christina,

We experimented around a bit more - figured out that the best solution is a custom Mattermost plugin that posts messages from the user to /webhooks/rest/webhook, receives the messages from Rasa, parses them and posts them in direct messaging. This way you don’t even have to initiate with the forward slash command. The other options all suffer from some kind of limitation (e.g. if you use an outgoing webhook without a trigger, Rasa gets triggered on its own message and falls into an infinite loop, it’s tough to enable a functional proactive messaging etc.).

Hi Haykharut,

That sounds like a good solution, and you don’t even have to tweak or extend the Rasa code then. Thank you for sharing it!

Hello haykharut,

Could you provide the source code of your plugin? It’s exactly what I need.

Hello Grogak,

Unfortunately can’t do, not my property and not open-source. However, if you know a bit of Golang, it’s pretty simple to write a plugin for Mattermost. The idea is that the plugin acts like a middleman, it captures the messages posted to the bot, sends them to RASA’s rest webhook, captures and parses RASA’s response and posts it back in the bot channel. Mattermost has documentation for this and there might be open source plugins for this purpose but I didn’t check myself.

Hi @Grogak,

did you figure it out? I’m trying to do the same.

Thanks in advance!

No I wasn’t successfull so I switched to Rocketchat instead of Rasa. Works fine with Rocketchat