Discourse 自动化

:discourse2: Summary Discourse Automation lets you automate actions through scripts and triggers. Customisation is made through an automatically generated UI.
:open_book: Install Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.

Features

  • Easy automation of complex workflows
  • Triggers automations at specific dates, periodically, or on specific events
  • Provides automatically generated UIs to specify options for your automation

Configuration

Automations can be created and updated from Admin → Plugins → Automations, or directly from /admin/plugins/discourse-automation.

Available scripts

Guide Script Trigger(s) Description
:bookmark: Add user to group through custom field :black_small_square:Recurring
:black_small_square:First logged on
Adds a user to a group based on a Custom User Field
:bookmark: Append last checked by :black_small_square:After post cook Adds a ‘last checked by’ function to the bottom of the OP
:bookmark: Append last edited by :black_small_square:After post cook Adds a ‘last edited by’ note to the bottom of the OP
:bookmark: Auto Responder :black_small_square:Post edited/created
:black_small_square:PM created
Given a series of keywords and associated replies, automatically respond with the corresponding reply
Auto Tag topic :black_small_square:Post created/edited
:black_small_square:PM created
Automatically tag a topic
Close topic :black_small_square:Point in time
:black_small_square:Stalled wiki
Automatically close a topic
Create Post :black_small_square:Recurring
:black_small_square:Point in time
Creates a post
Flag post on Words :black_small_square:Post edited/created Flag a topic on creation/edition if it contains specific words
Gift Exchange :black_small_square:Point in time Simple implementation of the Secret Santa game
Group Category Notification Default :black_small_square:Category created/edited Automatically sets a group notification level for newly created subcategories
Make banner topic :black_small_square:Point in time Convert a topic into a banner notice
Pin Topic :black_small_square:Point in time Pin and Unpin a topic in the future
Random Assign
(Assign)
:black_small_square:Point in time
:black_small_square:Recurring
Randomly Assign a topic
Schedule a PM with data explorer results
(Data Explorer)
:black_small_square:Recurring Send a regular PM with the results of a data explorer query
Send Chat message
(Chat)
:black_small_square:Event started
:black_small_square:Recurring
Sends a Chat message to a Channel
Send PMs :black_small_square:First accepted solution (Solved)
:black_small_square:User badge granted
:black_small_square:User added to group
:black_small_square:Stalled wiki
:black_small_square:Recurring
:black_small_square:User promoted
:black_small_square:API call
:black_small_square:User removed from group
Send PMs with support for placeholders
Suspend User By Email :black_small_square:API call Suspend a user for a specified duration
Topic required words :black_small_square:Topic Enforce the presence of at least one of the specified words in the posts of a topic
:bookmark: Triage posts using AI (Discourse AI) :black_small_square:Post created/edited Enhance the management and moderation of forum posts by automating the process of classifying posts
User Global Notice :black_small_square:Stalled topic
:black_small_square:First accepted solution (Solved)
Displays a global notice on the site for a specific user
:bookmark: User Group Membership through Badge :black_small_square:Recurring
:black_small_square:User first logged in
Automatically add users to a group based on their earned badges
Zapier webhook :black_small_square:User promoted
:black_small_square:User added to group
:black_small_square:User badge granted
:black_small_square:User removed from group
Calls a Zapier webhook

Available triggers

Note that due to their nature, each script only supports certain triggers. For example it wouldn’t make sense for a script enforcing the content of a post to trigger when a user is added to a group.

All of the available triggers are mentioned in the “Available scripts” table above.

Most of the triggers are self-explanatory, but here are a couple that may need a little more detail:

Trigger Description
After post cook Triggers after a post is rendered for display
API Call Triggers when a certain API endpoint is called
Stalled wiki Triggers when a wiki hasn’t been edited for a while
Stalled topic Triggers when a topic has not received replies after a certain time
Topic Triggers when a reply is made to a topic

If you need any clarification on any others please feel free to ask below. :slight_smile:

More scripts and triggers to come!

Custom Automations

You can also create custom Automations. :partying_face: Check out our developer’s guide for more information - Create custom Automations


:discourse2: Hosted by us? This plugin is available on our Business and Enterprise plans. Automation | Discourse - Civilized Discussion

Last edited by @tobiaseigen 2025-07-16T20:41:38Z

Check documentPerform check on document:
73 个赞

请注意,我已在 OP 中添加了一个包含所有现有自动化及其触发器伴随的表格。:+1:

(我也希望添加更多指南,因为“将用户添加到组…”的指南独自看起来有点孤单 :slight_smile:


Setting up the ‘Append last edited by’ automationSetting up the 'Append last checked by' automation 添加了另外几个演练。:tada:

还有一个全新的脚本,通过徽章进行用户组管理:partying_face: 那个刚刚发布,所以如果你尝试一下,请告诉我们你的使用情况。:+1:

10 个赞

我现在感觉自己非常非常……不是说蠢,但差不多。我可以在哪里构建自动化?在插件下,我只能启用或禁用自动化。

3 个赞

启用插件后,您应该在此处看到新项目:

可能需要刷新页面才能看到它。

3 个赞

我现在觉得自己真是太蠢了 :man_facepalming:

谢谢。

1 个赞

我之前也卡在那儿过 :slight_smile:

这个主题的回复可能应该设置为30天后自动删除。至少这个回复应该。

2 个赞

我们不再为 official 插件主题这样做。太多的好信息已丢失给主题计时器。我们现在手动管理它们,并将任何重要的讨论分成单独的标记主题(并鼓励人们首先开始单独的主题)。:+1:

18 个赞

帖子已拆分为新主题:Automation to close Solved topics and post a template response

:information_source: Discourse Automation 已与 Discourse 核心捆绑在一起,因此不再需要单独安装此插件。 :partying_face:

:discourse2: 由我们托管?此更改不会以任何方式影响您。 :+1: 如果您使用的是 Business 或 Enterprise 套餐,您可以继续使用此插件,无需担心任何问题。

6 个赞

是否有可以更改类别的自动化脚本?我想用它来创建一个更灵活的“计划发布”系统。

我设想该脚本将

  • 定期运行,并
  • 检查给定类别中在回复中带有某种标记的主题(例如,“标记为已解决”或“回复包含特定文本,如‘发布’”)。
  • 如果该回复的日期(或“已解决”状态)比给定的偏移量(例如,昨天或一周)更早,
  • 删除所有回复
  • 移动到给定类别
  • 可选地,添加可配置的标签

一个更复杂的版本可能会查找触发回复中的日期/时间,并在当前时间晚于该日期/时间时发布。

它也可能查找该帖子中的目标类别(具有脚本配置允许的目标类别)。因此,标签也是如此。

3 个赞

这可以做到,但目前还没有这样的东西。

1 个赞

您好,我不明白这个触发器的用例。它似乎可以发送私人消息,但发送给谁呢?因为 Wiki 可以被多个用户编辑。谢谢。

您将在 UI 中决定谁将接收 PM。

1 个赞

有没有办法创建自定义脚本?

此主题是关于寻找一种方法来要求审核私人消息。

所以我想象的是

  • 触发创建私人消息
  • 自动标记以供审核。

我认为可以:

不过这需要一些开发技能。

4 个赞

这很酷。想象一下,主题中的 Op(我链接的)可能会考虑赞助一个脚本,这取决于他们对该功能的需求有多大。

感谢 Jammy 迅速回复。一如既往地知识渊博。

2 个赞

您好,我不明白这个是如何工作的。我有一个自定义用户字段,可以接受“是”或“否”(下拉列表)两个值。但是,在创建自动化时,只要求我输入自定义字段的名称,而不是其值。如果我无法测试自定义字段的值,我该如何触发自动化将此用户添加到组中?谢谢。

自定义字段的值必须与组名匹配。因此,如果你的问题是“你更喜欢什么?”而你的答案是“狗”和“猫”,那么组的完整名称必须是“狗”和“猫”。你不能称它们为“爱狗人士”和“爱猫人士”。

链接的指南中有一个提示

但我一开始也没明白。

1 个赞

好的,我现在明白了,所以我的用例是不可能的:拥有一个可以回答“是”或“否”的自定义字段,因为组名应该是“是”或“否”…… :roll_eyes:

1 个赞

我能否根据帖子或帖子标题中的关键字来“自动标记帖子”?看起来它只能根据组或类别自动标记内容,这在我的情况下不太有用。