Configurar notificaciones de Mattermost usando el plugin discourse-chat-integration

This howto describes how to setup the Mattermost provider included in discourse-chat-integration.

Install

If you haven’t already, install the discourse-chat-integration plugin

Notifications

Set up Mattermost

Your Mattermost server needs to be accessible from your Discourse server in order to connect them. It is recommended that you use HTTPS, but HTTP should also work.

  1. In your Mattermost System Console, under Custom Integrations, check that these settings are enabled:

    • Enable Incoming Webhooks
    • Enable integrations to override usernames
    • Enable integrations to override profile picture icons
    • Enable Custom Slash Commands (if you want slash commands)
  2. Login to your team, click your name in the top left, then click Integrations

  3. Choose Incoming Webhooks, Add incoming Webhook

  4. Enter a “Display Name”, “Description”, and choose a random channel from the list (it doesn’t matter which one, Discourse will override this)

  1. Save

  2. Copy the URL provided, you’ll need it later

Setup Discourse

  1. Paste the URL you copied into the chat_integration_mattermost_webhook_url site setting

  2. Enable chat_integration_mattermost_enabled

  3. Setup some “Rules” for your channels, according to the discourse-chat-integration instructions. Channel identifiers look like #town-square or @davidtaylor.

  4. Click Test on one of the channels to check everything’s working. You should receive a message like this:
    26

  5. :unicorn:

Slash Commands

Slash commands allow you to manage your rules from inside Mattermost. To get it working:

  1. If you didn’t already, enable Enable Custom Slash Commands in your Mattermost System Console

  2. Login to your team, click your name in the top left, then click Integrations

  3. Choose Slash Commands, Add slash command

    • Display Name: Discourse
    • Description: Manage Discourse notification rules
    • Command Trigger Word: discourse
    • Request URL: <your-discourse-url>/chat-integration/mattermost/command
    • Request Method: POST
    • Response Username: Discourse
    • Response Icon: (optionally specify an icon URL)
    • Autocomplete: :ballot_box_with_check:
    • Autocomplete Hint: Manage this channel's integration with Discourse
    • Autocomplete Description: [watch|follow|mute|delete|status|help]
  4. Save

  5. Copy the “Token” provided, and paste it into your Discourse site settings under chat_integration_mattermost_incoming_webhook_token

  6. Try sending /discourse help in your mattermost channel - you should get a message with a list of possible commands

  7. :1st_place_medal:

Last edited by @JammyDodger 2024-05-26T07:09:54Z

Check documentPerform check on document:
11 Me gusta

I recommend you also post this on the mattermost Discourse to get more feedbacks :cowboy_hat_face:

and probably a dedicated topic.

(also I wish we warned communities about hideous looking oneboxes cause they are missing images)

6 Me gusta

I think we already do in the dashboard if they use the default images for the logos.

1 me gusta

Mattermost integration now supports slash commands (their implementation is built to be compatible with Slack’s) :tada:

I have also created a topic about it on the Mattermost forum, it can be found here:

5 Me gusta

Hello! I am getting a broken image link to the right of the mattermost post. I tried to see the image url and it looks like an actual post instead of an image:

http://destek.hugin.com.tr/t/hugin-destek-topluluguna-hos-geldiniz/183/1

Is it intended to be the post author image I wonder?

Any tips on how to fix it?

Hi @nommaz - sorry about that. It was indeed trying to load an image from the URL of the post, which clearly isn’t going to work :wink:

I’ve fixed it now, so if you update to the latest version of the plugin it should work as intended :slight_smile:

https://github.com/discourse/discourse-chat-integration/commit/438a9d92fe6be632b825238ce703a03dd20d285b

2 Me gusta

Hi David didnt work unfortunately

Are you sure it is not an issue with mattermost_provider.rb:68 ?

Thanks

Vedat

Oops, I made the change in the slack provider instead of mattermost :facepalm:

Just added another commit to correct the error, so please can you give it another try :slight_smile:

1 me gusta

Thanks! All set now :slight_smile:

What’s up if I get a 422 error when trying (test) to hook to Mattermost?

Make sure you copied the webhook URL correctly, and that there are no spaces before/after the URL. Is your mattermost server accessible to the internet? Or just an internal network?

3 Me gusta

What’s the best way to handle multiple teams / multiple mattermost servers?

Tengo integración de chat con Mattermost habilitada. Me suscribí a todas las categorías “de nivel superior” que se muestran con el comando “/discourse watch”, pero las publicaciones en “subcategorías” no se capturan.

Toma esta publicación: https://openziti.discourse.group/t/this-is-a-test-topic-in-the-sdks-category/271
Se retransmite a Slack correctamente, pero NO se retransmite a Mattermost. Slack puede suscribirse a “todas las categorías”. Mattermost no parece poder hacerlo.

He probado toda la sintaxis que se me ocurre, pero no he tenido suerte. ¿Algún consejo?

Gracias de antemano…

1 me gusta

@david: lamento mencionarte, pero me faltan las publicaciones de discourse en mi integración de chat. ¿hay alguna posibilidad de que todavía estés siguiendo este hilo?

Por el momento, las subcategorías no se incluyen automáticamente cuando “sigues” una categoría. Necesitarás añadir cada subcategoría individualmente o usar la opción “todas las categorías”.

1 me gusta

¡Hola, gracias por responder! Sería genial si pudiera averiguar “cómo”. ¿Las únicas categorías que el plugin parece reconocer son las categorías principales?

Encontré/probé la opción “todas las categorías” pero tampoco parece funcionar. Me encantaría poder usar “todas”, sería IDEAL… ¿Lo estoy “haciendo mal”? Vea la captura de pantalla a continuación.

Hola @david… el problema con lo anterior es que no puedo averiguar cómo suscribirme a una “subcategoría”, ni parece haber un “todas” que pueda usar. Me encantaría resolver esto.

¡Gracias!

1 me gusta

¡Disculpa la demora en responder, @Clint_Dovholuk!

Usando comandos de barra, creo que puedes seguir todas las categorías así:

/discourse watch

Pero la forma más fácil de configurar las reglas de notificación es desde el panel de administración de Discourse. Allí, todas las opciones se muestran claramente en la interfaz de usuario, por lo que no hay necesidad de intentar descifrar la sintaxis precisa del ‘comando de barra’. Consulta la sección ‘configurar reglas’ de la documentación del plugin para obtener más información.

2 Me gusta

Gracias @david.

Publico una captura de pantalla del comando de barra diagonal antes. La republico aquí… puedes ver que las ‘subcategorías’ no están listadas un post o dos arriba…

Había intentado la página de administración antes, pero se cerraba inmediatamente el menú desplegable cuando la usaba… Sin embargo, presionar la ‘flecha hacia abajo’ pareció arreglar lo que necesitaba.

REALMENTE me gustaría una opción de ‘todo’. ¿Es esto un plugin que puedo editar/arreglar de alguna manera??? Ahora mismo se ve así :confused:

Para recibir notificaciones de todos los temas, te sugiero eliminar todas esas reglas específicas de categoría y luego agregar una sola regla de ‘todas las categorías’.

¿Puedes compartir más detalles sobre lo que ves aquí? ¡Serían geniales algunas capturas de pantalla o un video!

Al editar una ‘regla’, deberías poder usar el menú desplegable de categoría para elegir ‘(sin categoría)’.

Una vez guardado, debería verse así:

(‘sin categoría’ en el menú desplegable es claramente una mala descripción de lo que realmente significa. Lo arreglaré)

Creo que las subcategorías se omiten del texto de ayuda por cuestión de espacio. Pero aún puedes suscribirte a categorías usando su ‘slug’ (el nombre de la subcategoría de la URL). Así que en el caso de #howto:admins aquí en Meta, sería /discourse watch admins.