# What is the correct process for custom automation?

**URL:** https://meta.discourse.org/t/topic/394869
**Category:** Support
**Created:** [February 1, 2026, 4:07am UTC](https://meta.discourse.org/t/topic/394869 "2026-02-01T04:07:49Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![qi\_lu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qi_lu/32/536755_2.png) [@qi\_lu](https://meta.discourse.org/u/qi_lu)
#### Post date: [February 1, 2026, 4:07am UTC](https://meta.discourse.org/t/topic/394869/1 "2026-02-01T04:07:49Z")

</div>

I am a beginner and have some questions about the [Create Custom Automations tutorial](https://meta.discourse.org/t/create-custom-automations/275931).

I first tried writing the automation script directly in the GitHub Codespace development environment (I don’t understand the syntax; the code was written by Claude).  
After modification, the file structure should look like this:

```plaintext
plugins/automation/
├── lib/
│ └── discourse_automation/
│ ├── scripts.rb # Modified
│ └── scripts/
│ ├── ... # Other scripts
│ └── remove_expired_group_members.rb # Added
└── config/
    └── locales/
        ├── server.en.yml # Modified
        ├── client.en.yml # Modified
        ├── server.zh_CN.yml # Modified
        └── client.zh_CN.yml # Modified

```

However, I am unsure if this operation is permissible in a production environment.  
Furthermore, I am unsure if these modifications will be lost during a rebuild or an update to the automation plugin, so I dare not try it in the production environment. Perhaps I should submit a feature request for the plugin maintainers to add it?

I hope experienced friends can inform me about the correct procedure from writing tests to applying changes in the production environment.  
Thank you very much!

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [February 1, 2026, 4:15am UTC](https://meta.discourse.org/t/topic/394869/2 "2026-02-01T04:15:14Z")

</div>

I believe it will have to be in a new plugin.

You can check out:

> [@Automation script: Move topic on close](https://meta.discourse.org/t/automation-script-move-topic-on-close/381559):
>
> information_sourceSummary Moves a topic to another category when it gets closedhammer_and_wrenchRepository Link [GitHub - chapoi/move-topic-on-close: Automation script for Discourse · GitHub](https://github.com/chapoi/move-topic-on-close)open_bookInstall Guide [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157)Features Simple script as an example on [Create custom Automations](https://meta.discourse.org/t/create-custom-automations/275931) When a topic in category A is closed, it will be automatically moved to a predefined category B. Configuration Requires [Discourse Automation](https://meta.discourse.org/t/discourse-automation/195773) to be ins…

---

<div class="post-metadata">

### Author: ![qi\_lu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qi_lu/32/536755_2.png) [@qi\_lu](https://meta.discourse.org/u/qi_lu)
#### Post date: [February 1, 2026, 4:25am UTC](https://meta.discourse.org/t/topic/394869/3 "2026-02-01T04:25:32Z")

</div>

I have checked the link you provided.  
Could you please explain to me why I should use plugins instead of creating scripts within the automation plugin?

1. I am not a professional, and creating plugins seems more difficult.
2. I have many functions that need to be implemented, which seems like it would require creating many plugins? (Although I also like plugins because they can be shared.)

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [February 1, 2026, 4:27am UTC](https://meta.discourse.org/t/topic/394869/4 "2026-02-01T04:27:00Z")

</div>

If I’m not wrong, if you make changes to the plugin, it will be overwritten the next time there’s an update.

---

<div class="post-metadata">

### Author: ![qi\_lu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qi_lu/32/536755_2.png) [@qi\_lu](https://meta.discourse.org/u/qi_lu)
#### Post date: [February 1, 2026, 4:31am UTC](https://meta.discourse.org/t/topic/394869/5 "2026-02-01T04:31:45Z")

</div>

OK, that’s what I was afraid of.  
So the custom automation feature doesn’t seem to mean much to the user? 😂  
I’ll check the documentation again, and if that doesn’t work, I’ll try creating a plugin.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [February 1, 2026, 11:11am UTC](https://meta.discourse.org/t/topic/394869/6 "2026-02-01T11:11:00Z")

</div>

> [@qi\_lu](#):
>
> So the custom automation feature doesn’t seem to mean much to the user? 😂

I think the tutorial (which is a draft) is lacking this information. It explains _how_ to create new automations, but not _where_ to do it. The answers mention plugin examples though, like the one linked by @NateDhaliwal.

Simon also suggests having a look at the [data explorer](https://meta.discourse.org/t/32566?silent=true) plugin: [Create custom Automations - #6 by simon](https://meta.discourse.org/t/create-custom-automations/275931/6).

> [@qi\_lu](#):
>
> So the custom automation feature doesn’t seem to mean much to the user? 😂

Depends what you mean by “user”? 😄 As a developer, you can surely create a new plugin that adds automations. This is the way to do it properly.

Since you mention not understanding code, but being able to use AI for this, perhaps you’ll find this discussion interesting. [Claude & Discourse-related development. How good is it?](https://meta.discourse.org/t/claude-discourse-related-development-how-good-is-it/394773).

I’m currently experimenting with this (but I do have vague notions of code – not enough to create even a simple plugin by myself!), and will share my recent experience with it soon.

Since Claude directed you to edit the automation plugin, you may want to refine your prompts and have the AI follow actual good practices.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 1, 2026, 2:22pm UTC](https://meta.discourse.org/t/topic/394869/7 "2026-02-01T14:22:06Z")

</div>

> [@qi\_lu](#):
>
> So the custom automation feature doesn’t seem to mean much to the user?

No. What makes it a _custom_ automation is that it’s not one that is built in. You’ll need to add a new one in a plugin. [GitHub - scossar/automation-script-example: An example of how to add a custom script to the Discourse Automation plugin. · GitHub](https://github.com/scossar/automation-script-example), linked in the tutorial. You can start with that and try telling whatever AI that you want to add a new customization.

What do you want your custom automation to do?

---

<div class="post-metadata">

### Author: ![qi\_lu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/qi_lu/32/536755_2.png) [@qi\_lu](https://meta.discourse.org/u/qi_lu)
#### Post date: [February 1, 2026, 3:46pm UTC](https://meta.discourse.org/t/topic/394869/8 "2026-02-01T15:46:47Z")

</div>

I need an automation script that can automatically remove group members whose membership has expired.  
Set the group and duration, and users will be automatically removed upon expiration.

For example:  
Setting: VIP Group, 30-day duration.  
When a user joins the VIP group, they are removed after 30 days.

I am increasingly confused about whether the automation plugin can save scripts that I write myself (previous comments indicated they might be overwritten).

If it were you, how would you typically use the automation plugin?  
Could you accurately describe your usage method (when the built-in scripts and triggers of the automation plugin cannot meet the needs)?  
I think I can learn how custom features work from your scenario description.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 1, 2026, 3:58pm UTC](https://meta.discourse.org/t/topic/394869/9 "2026-02-01T15:58:48Z")

</div>

How are users added to the vip group? Or probably makes sense to have whatever adds them to the group to also remove them. That’s what the subscription plugin does, for example.

Automations are not removed, but editing code in your container is.

You need a trigger for when a user is added to a group, and an action to remove them from a group after a period of time. I’m not sure how easy that is to do.
