Discourse Automation

:mega: This plugin is now bundled with Discourse core. There is no need to install the plugin separately.

:discourse2: Summary Discourse Automation lets you automate actions through scripts and triggers. Customisation is made through an automatically generated UI.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-automation
:open_book: Install Guide How to install plugins in Discourse

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 (Official Discourse AI Plugin) :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

72 Likes

Just to note, Iā€™ve updated the OP with a table of all the existing Automations and their accompanying triggers. :+1:

(Iā€™m also hoping to add more guides too, as the one for ā€˜Add user to groupā€¦ā€™ looks a bit lonely all by itself :slight_smile:)


There are a couple more walkthroughs added for 'Append last edited by' Automation and 'Append last checked by' Automation. :tada:

And a brand new script, User Group Membership through Badges. :partying_face: That one is pretty hot off the press so if you try it out, let us know how you get on. :+1:

9 Likes

Now I feel myself very veryā€¦ not stupid, but close. Where can I build up automations? Under plugins I can only enable or disable Automation.

1 Like

After enabling the plugin, you should see new item here:

It might require refreshing the page to see it.

2 Likes

Aaand now I feel myself really stupid :man_facepalming:

Thanks.

1 Like

Iā€™ve been stuck on that one before :slight_smile:

Replies to this topic should probably get set to auto delete after 30 days. At least this reply should.

1 Like

We no longer do that for official plugin topics. Too much good information has been lost to the topic timers. We now curate them manually and split any significant discussions into separate tagged topics (as well as encourage people to start separate topics to begin with). :+1:

17 Likes

A post was split to a new topic: Automation to close Solved topics and post a template response

:information_source: Discourse Automation has now been bundled with Discourse core, so this plugin will no longer need to be installed separately. :partying_face:

:discourse2: Hosted by us? This change will not affect you in any way. :+1: If you are on the Business or Enterprise plans, you can continue to enjoy this plugin and not worry about a thing.

4 Likes

Is there an automation script that can change Category? Iā€™d like to use it to make a more flexible ā€œSchedule Publishingā€ system.

Iā€™m imaging that the script would

  • run periodically, and
  • check for topics in a given category which have some marker in a reply (like, marked as solved or reply contains certain text, like ā€œPUBLISHā€).
  • If the date of that reply (or ā€œsolvedā€ status) is longer ago than a given offset (like, yesterday, or a week),
  • delete all replies
  • move to given category
  • optionally, add configurable tags

A more sophisticated version might look for a date/time in the trigger reply, and publish if it is now after that date/time.

It also might look for the target category in that post (with script config for allowed target categories). And for that matter, tags.

3 Likes

This is doable, but nothing like this exists at the moment.

1 Like

Hi, I do not understand the use case for this trigger. It seems to be able to send a PM, but to who? Since a Wiki can be edited by several users. Thanks.

You decide in the UI who is going to receive the PM.

1 Like

Is there a way to create a custom script?

This topic the person is looking for a way to have PMs require moderation.

So I would imagine

  • Trigger Create PM
  • Automated flagging for review.

I believe so:

Though it would require some dev skills.

4 Likes

That is quite cool. Imagine the Op in topic I linked might consider sponsoring a script depending on how strongly they need that functionality.

Thanks Jammy for the speedy response. As always a wealth of knowledge.

2 Likes

Hi, I donā€™t get how this one is working, I have a custom user field which can take two values Yes or No (drop down). But when creating the automation I am asked only the name of the custom field, not its value. How do I trigger the automation to add this user to the group if I cannot test the value of the custom field? Thanks.

The value of the custom field has to match the group name. So if your question is ā€œwhat do you like more?ā€ And your answers are ā€œdogsā€ and ā€œcatsā€, the full names of the groups must be ā€œdogsā€ and ā€œcatsā€. You cannot call them ā€œdog loversā€ and ā€œcat loversā€

There is a hint in the linked guide

but I didnā€™t understand at first either.

1 Like

Ok I get it now, so my use case is not possible: having a custom field you can answer Yes or No because the group name should be Yes or Noā€¦ :roll_eyes:

1 Like

Can I ā€œAuto Tag Postsā€ based on keywords within the post or post title? Seems like it can only auto tag things based on group or category, which is not super useful for my case.