Summary: Discourse Automation lets you automate actions through scripts and triggers. Customisation is made through an automatically generated UI.

Status: :warning: Beta

:link: GitHub: GitHub - discourse/discourse-automation
:arrow_right: Install: Follow the plugin installation guide.


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


  • trigger: represents the name of the trigger, eg: user_added_to_group
  • triggerable: represents the code logic associated to a trigger, eg: triggers/user_added_to_group_.rb
  • script: represents the name of the script, eg: send_pms
  • scriptable: represents the code logic associated to a script, eg: scripts/send_pms.rb


Automations are created from /admin/plugins/discourse-automation

Available scripts

  • Pin Topic, allows to pin and unpin a topic in the future
  • Send PMs, allows to send PMs with support for placeholders
  • Gift Exchange, simple implementation of the secret santa game
  • Topic required words, enforce presence of specified words in a the posts of a topic
Through discourse-assign
  • Random assign will soon be available

Available triggers

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

  • Recurring, allows to trigger an automation every day for example
  • Point in Time, allows to trigger an automation at a specific date
  • Post created/edited, triggers an automation when a post of a specified topic is edited or created
  • User added to group, triggers an automation when a user is added to a group
  • Stalled wiki, triggers an automation when a wiki hasn’t been edited for a while
  • More to come…

Plugin API

add_automation_scriptable(name, &block)
add_automation_triggerable(name, &block)

Scriptable API


field :name, component: lets you add a customisable value in your automation’s UI.

List of valid components:

text, text_list, category, group, boolean, date_time, tags, user, choices

# foo must be unique and represents the name of your field.

field :foo, component: :text # generates a text input
field :foo, component: :list # generates a multi select text input where users can fill values
field :foo, component: :choices, extra: { content: [ {id: 1, name: 'your.own.i18n.key.path' } ] } # generates a combo-box with a custom content
field :foo, component: :boolean # generate a checkbox input
field :foo, component: :category # generates a category-chooser
field :foo, component: :group # generates a group-chooser
field :foo, component: :date_time # generates a date time picker
field :foo, component: :tags # generates a tag-chooser
field :foo, component: :user  # generates a user-chooser
triggerables and triggerable!
# Lets you define the list of triggerables allowed for a script
triggerables %i[recurring]

# Let's you force a triggerable for you script and also let's you force some state on fields
field :recurring, component: :boolean
triggerable! :recurring, state: { foo: false }
# Lets you mark a key has replaceable in texts using placeholder syntax %%sender%%
placeholder :sender

Note that’s it’s the responsibility of the script to provide values for placeholders and to apply the replacement using input = utils.apply_placeholders(input, { sender: 'bob' })


This is the heart of an automation and where all the logic happens.

# context is sent when the automation is triggered can differ a lot between triggers
script do |context, fields, automation|


Each field you will use will depend on i18n keys and will be namespaced to their trigger/script.

For example a scriptable with this content:

field :post_created_edited, component: :category

Will require the following keys in client.en.yml:

              label: Category
               description: Optional, allows to limit trigger execution to this category

Note that description is optional here.


Thank you, thank you!


Amazing idea! Literally 5min before I saw this we had a perfect use case for such a plugin. We are looking to automatically archive topics based on a date trigger so that users cannot give any more likes to its posts.

We have topics for monthly photocontests in which users post their photos and users can give likes to their favorites. From those the top 5 most liked go into a final voting. Only issue is that users can still like photo submissions even after the given deadline.


I would love for this this plugin to also optionally trigger chat-integration plugin, to trigger a reply or notification on associated chat systems as well.

If you’re taking feature requests at any point, I would love to automate the publishing and unpublishing of the global notice at https://thisismydiscoursesite.com/admin/site_settings/category/uncategorized


The fact that adding and removing a global notice is manual really cuts down on our ability to strategically use it to promote events or highlight other time sensitive things in our community.


Yes it could definitely go into core automation. :+1:


On 2.7.6 Stable there is no selectable calendar or trash can icon when creating an automation. Unsure of how to manually fill out Execute at to create a weekly, recurring pinned topic. Dates seem specific as opposed to a relative day of the week (Tuesday) or month.

Can you show me a screen of what you are looking at please?

On master I correctly see this:
Capture d’écran 2021-07-19 à 16.27.04

2.7.6 stable on Firefox 90.0 (64-bit)

I see a trash can icon after writing in a value.


Sadly this component doesn’t work with firefox yet.


Thank you, works with Chromium.

Is it possible to trigger based on general day of the week? Looking to automate a recurring pinned topic rule.

Pin each Monday
Unpin each Tuesday

Currently the rule is defined as 7/26 at 7:45am pin through 7/27 at 11:59pm
I don’t see an option to set as recurring.

ATM this script pin_topic is only working with point_in_time, could be made to work with recurring though.


Firefox can be used, at least for pinning topics in the plugin. Execute at and Pinned until must be typed in manually as displayed below:


Yes firefox treats it as a regular text input


Hi I was wondering if you could use this with Discourse Signatures → To enable Signatures on new user sign up?

If so how would one set this up? The discourse Signature plugin does not give option to have enabled by default.

Yes you could most likely, I dont know this plugin. It should be a PR to the plugin.

1 Like

Waiting for this :taco:

This can really help.

1 Like