使用 discourse-chat-integration 插件设置 Mattermost 通知

howto 介绍了如何设置包含在 discourse-chat-integration 中的 Mattermost 提供商。

启用

discourse-chat-integration 插件已随 Discourse 捆绑,无需单独安装。要启用它,请确保 chat_integration_enabled 站点设置已开启。

通知

设置 Mattermost

您的 Mattermost 服务器必须可从您的 Discourse 服务器访问,以便建立连接。建议使用 HTTPS,但 HTTP 也应能正常工作。

  1. 在 Mattermost 的 系统控制台 中,进入 自定义集成,确认以下设置已启用:

    • 启用传入 Webhook
    • 允许集成覆盖用户名
    • 允许集成覆盖个人资料头像图标
    • 启用自定义斜杠命令(如果您需要使用斜杠命令)
  2. 登录您的团队,点击左上角的您的名字,然后点击 集成

  3. 选择 传入 Webhook,然后点击 添加传入 Webhook

  4. 输入“显示名称”和“描述”,并从列表中选择任意一个频道(具体是哪个并不重要,Discourse 会覆盖此设置)

  1. 点击 保存

  2. 复制提供的 URL,稍后将会用到

设置 Discourse

  1. 将复制的 URL 粘贴到 chat_integration_mattermost_webhook_url 站点设置中

  2. 启用 chat_integration_mattermost_enabled

  3. 根据您的频道设置一些“规则”,具体操作请参考 discourse-chat-integration 的说明。频道标识符类似 #town-square@davidtaylor

  4. 点击其中一个频道上的 测试,以确认一切正常。您应该收到类似以下内容的消息:

  5. :unicorn:

斜杠命令

斜杠命令允许您从 Mattermost 内部管理规则。要使其正常工作:

  1. 如果尚未启用,请在 Mattermost 的 系统控制台 中启用 启用自定义斜杠命令

  2. 登录您的团队,点击左上角的您的名字,然后点击 集成

  3. 选择 斜杠命令,然后点击 添加斜杠命令

    • 显示名称:Discourse
    • 描述:管理 Discourse 通知规则
    • 命令触发词:discourse
    • 请求 URL<your-discourse-url>/chat-integration/mattermost/command
    • 请求方法:POST
    • 响应用户名:Discourse
    • 响应图标:(可选指定图标 URL)
    • 自动完成:ballot_box_with_check:
    • 自动完成提示管理此频道与 Discourse 的集成
    • 自动完成描述[watch|follow|mute|delete|status|help]
  4. 点击 保存

  5. 复制提供的“令牌”,并将其粘贴到 Discourse 站点设置中的 chat_integration_mattermost_incoming_webhook_token 字段下

  6. 尝试在 Mattermost 频道中发送 /discourse help,您应该会收到一条包含可用命令列表的消息

  7. :1st_place_medal:

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:

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 管理面板中进行。在那里,所有选项都清晰地显示在用户界面中,因此无需尝试弄清楚精确的“斜杠命令”语法。请查看插件文档中有关“配置规则”(configuring rules) 的部分以获取更多信息。

2 个赞

谢谢 @david

我之前发布了斜杠命令的截图。在此处重新发布……您可以看到“子类别”未在上面的一两个帖子中列出……

我之前尝试过管理页面,但当我使用它时,它会立即关闭下拉菜单……但是按下“向下箭头”似乎能解决我需要的问题。

我__真的__想要一个“全部”选项。这是一个我可以编辑/修复的插件吗???现在它看起来像这样 :confused:

要获取所有主题的通知,我建议删除所有特定于类别的规则,然后添加一个“所有类别”规则。

你能分享更多关于你在这里看到的内容的细节吗?截图或视频会很有帮助!

在编辑“规则”时,您应该可以使用类别下拉菜单选择“(无类别)”。

保存后,它应该看起来像这样:

(下拉菜单中的“无类别”显然是对其真正含义的糟糕描述。我会修复它)

我认为子类别被省略了帮助文本以节省空间。但是您仍然可以通过使用它们的“slug”(URL 中子类别的名称)来订阅类别。所以在像 Meta 上的 #howto:admins 这样的情况下,它将是 /discourse watch admins