Set up Mattermost notifications using the discourse-chat-integration plugin

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

Enable

The discourse-chat-integration plugin is bundled with Discourse. No separate installation is required. To enable it, check that the chat_integration_enabled site setting is turned on.

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:

  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개의 좋아요

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개의 좋아요

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

1개의 좋아요

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개의 좋아요

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개의 좋아요

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개의 좋아요

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개의 좋아요

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

Mattermost 채팅 연동이 활성화되어 있습니다. “/discourse watch” 명령어로 표시되는 모든 “상위” 카테고리를 구독했지만, "하위 카테고리"에 게시된 내용은 감지되지 않습니다.

다음 게시물을 예로 들겠습니다: https://openziti.discourse.group/t/this-is-a-test-topic-in-the-sdks-category/271

이 게시물은 Slack으로 정상적으로 전달되지만, Mattermost로는 전달되지 않습니다. Slack은 "모든 카테고리"를 구독할 수 있지만, Mattermost는 그렇지 않은 것 같습니다.

생각할 수 있는 모든 구문을 시도해 보았지만 해결하지 못했습니다. 조언을 주실 수 있을까요?

미리 감사드립니다…

1개의 좋아요

@david - 멘션을 드려 죄송합니다. 채팅 연동에서 Discourse 게시글이 보이지 않아요. 혹시 이 스레드를 아직 보고 계신가요?

현재 카테고리를 "감시"하더라도 하위 카테고리가 자동으로 포함되지 않습니다. 각 하위 카테고리를 개별적으로 추가하거나 “모든 카테고리” 옵션을 사용해야 합니다.

1개의 좋아요

안녕하세요, 답장 주셔서 감사합니다!!! ‘어떻게’ 하는 건지 알 수 있다면 정말 좋겠어요. 플러그인이 인식하는 것으로 보이는 카테고리는 최상위 카테고리뿐인 것 같아요?

‘모든 카테고리’ 옵션을 찾아서 시도해 봤는데, 그것도 작동하지 않는 것 같네요. 정말 '모두’를 사용하고 싶은데, 그게 이상적이거든요… 제가 ‘잘못’ 하고 있는 건가요? 아래 스크린샷을 확인해 주세요

@david 님… 위 방법의 문제는 하위 카테고리에 구독하는 방법을 찾지 못하고, 사용할 수 있는 “모두” 옵션도 없는 것 같습니다. 이 문제를 해결하고 싶습니다.

감사합니다!

1개의 좋아요

늦게 답변드려서 죄송합니다, @Clint_Dovholuk!

슬래시 명령어를 사용하면 이렇게 모든 카테고리를 시청할 수 있을 것 같습니다:

/discourse watch

하지만 알림 규칙을 설정하는 가장 쉬운 방법은 Discourse 관리자 패널을 사용하는 것입니다.在那里 모든 옵션이 UI에 명확하게 표시되어 있어, 정확한 ‘슬래시 명령어’ 구문을 알아내려 할 필요가 없습니다. 자세한 내용은 플러그인 문서의 ‘규칙 설정’ 섹션을 참고해 주세요.

2개의 좋아요

감사합니다 @david .

이전에 슬래시 커맨드 스크린샷을 올린 적이 있습니다. 여기에 다시 올립니다… '하위 카테고리’가 위 포스트 두어 개 위에 나열되어 있지 않은 것을 볼 수 있습니다…

이전에 관리자 페이지를 시도해 봤는데, 사용할 때마다 드롭다운이 즉시 닫혔습니다… 하지만 '아래 화살표’를 누르면 제가 필요로 하는 것이 풀리는 것 같았습니다.

‘전체(all)’ 옵션이 정말 필요합니다. 제가 어찌어찌 편집/수정할 수 있는 플러그인인가요??? 지금은 이렇게 보입니다 :confused:

모든 토픽의 알림을 받으려면, 해당 카테고리별 규칙을 모두 삭제한 뒤 ‘모든 카테고리’ 규칙을 하나만 추가하는 것을 권장합니다.

여기서 정확히 어떤 현상이 보이는지 좀 더 자세히 알려줄 수 있을까요? 스크린샷이나 동영상이 있다면 매우 좋겠습니다!

'규칙’을 편집할 때, 카테고리 드롭다운을 사용해 '(카테고리 없음)'을 선택할 수 있어야 합니다.

저장된 후에는 이런 모습이어야 합니다:

(드롭다운의 '카테고리 없음’은 실제로 의미하는 바를 잘 설명하지 못하는 잘못된 표현입니다. 이 부분은 수정하겠습니다)

도움말 텍스트의 공간 절약 차원에서 하위 카테고리가 생략된 것 같습니다. 하지만 ‘슬러그’(URL에 표시되는 하위 카테고리 이름)를 사용하면 여전히 카테고리에 구독할 수 있습니다. 예를 들어, Meta의 #howto:admins의 경우 /discourse watch admins를 사용하게 됩니다.