자동 응답자 자동화 만들기

:bookmark: This guide explains how to set up an auto responder using the Automation Plugin in Discourse. The auto responder can automatically reply to posts or personal messages containing specific keywords.

:person_raising_hand: Required user level: Administrator

An auto responder in Discourse can automatically reply to posts containing certain keywords or phrases. This feature can help moderators and administrators focus on more complex tasks by automating responses to common queries or situations.

Summary

This guide covers:

  • Creating a new auto responder script
  • Choosing and configuring a trigger
  • Setting up word/answer pairs
  • Enabling the automation

Creating a new script

  1. Navigate to your site’s automation’s page at example.discourse.com/admin/plugins/automation
  2. Click + Create to create a new script
  3. Select the Auto Responder option
  4. Click + Create again to proceed

Choosing a trigger

Select one of two trigger options:

  1. Post Created / Edited
  2. Personal Message Created

Post Created / Edited trigger options

  • Action Type: Limit to posts being created or edited
  • Topic Type: Limit to all topics, public topics only, or personal messages only
  • Categories: Limit to specific categories
  • Exclude subcategories: Only trigger if the topic is exactly in the specified categories (not their subcategories)
  • Tags: Limit to posts in topics with specific tags
  • Restricted Groups: Limit to posts by users in specific groups
  • Excluded Groups: Skip if the post user belongs to any of these groups
  • Restricted Inboxes Groups: Limit to personal messages in specific group inboxes
  • Ignore Automated: Skip if the sender has a noreply email or is from an automated source (only applies to posts created via email)
  • Valid Trust Levels: Limit to posts from users with specific trust levels
  • Original Post Only: Trigger only on the original post (OP) of a topic
  • First Post Only: Limit to a user’s first post
  • First Topic Only: Limit to a user’s first topic
  • Skip via Email: Skip the trigger if the post was created via email
  • Post Features: Limit to posts containing specific features (images, links, code, or uploads)

Personal Message Created trigger options

  • Users: Limit to PMs sent to specific users
  • Group: Limit to PMs sent to a specific group
  • Ignore Staff: Skip if the sender is a staff user
  • Ignore Automated: Skip if the sender has a noreply email or is from an automated source (only applies to PMs created via email)
  • Ignore Group Members: Skip if the sender is a member of the specified group
  • Valid Trust Levels: Limit to PMs from users with specific trust levels

Configuring script options

After setting up the trigger, configure the following options:

  1. Word / answer pairs: Define keywords and corresponding responses
  2. Answering user: Select the user account for automated replies (defaults to the System user)
  3. Once checkbox: Limit the automation to trigger only once per topic

Setting up word/answer pairs

  1. Click the Configure button next to list of word / answer pairs
  2. Enter key/value pairs:
    • Key: The trigger word or phrase (case-insensitive)
    • Value: The automated response text

:information_source: The key is evaluated as a regex string with word boundary matching. Escape special characters like . with a backslash (e.g., \\.). You can test your Regex expressions on regex101.com using the Ruby flavor.

:mega: Use %%KEY%% in the value field as a placeholder for the detected trigger word. You can also use %%SENDER_USERNAME%% as a placeholder for the answering user’s username.

:bulb: If multiple word/answer pairs match the same post, all matching responses are combined into a single reply (separated by blank lines).

Enabling the automation

  1. Check the Enabled checkbox at the bottom of the screen
  2. Click Update to save your changes

:warning: Automations can be saved without being enabled by leaving the Enabled checkbox unchecked.

Last edited by @hugh 2024-07-26T02:28:53Z

Check documentPerform check on document:
9개의 좋아요

Is it possible to limit the auto-response to the initial post for a topic? One might think that Once would do that, but (in obvious retrospect) that’s only correct if the topic is created after the automation.

1개의 좋아요

Alternately (or additionally?), could the auto-post be back-dated to come immediately after the topic OP (and then merged in that order)?

1개의 좋아요

My use case: replying to topics in a certain category with a new poll for that topic.

1개의 좋아요

So… you have a category of old discussions, and when someone replies there you get an auto-response that is not useful, but does contain information that is useful in response to a topic being created… correct? :smiley:

If that is the case, unfortunately I do not think this automation currently supports that behavior. I ran through the other automations, and I think the only one that might work would be triage with AI, but that seems expensive to get the results you are looking for. :sweat_smile:

3개의 좋아요

Yes, correct. How hard would it be to make a new option for this one where it would only respond to new topics?

1개의 좋아요

4 posts were split to a new topic: Can the auto-responder fire on @mentions?

A post was split to a new topic: Post Created / Edited Trigger for Send PMs Automation

Are there any other template variables available in the reply? I would like to be able to access the username of the person who PM’ed a group.

현재, 자동 응답자 자동화에서 감지된 트리거 단어를 위한 플레이스홀더로 value 필드에 %%KEY%%를 사용하는 것이 우리가 사용할 수 있는 유일한 템플릿 변수입니다.

자동 응답자 자동화에서 그룹에 DM을 보낸 사용자의 사용자 이름을 가져오는 내장 변수가 없는 것 같습니다. 이는 현재 구현의 한계로, 다른 Discourse 기능(이메일 템플릿, AI 페르소나, “DM 보내기” 자동화 스크립트 등)에는 다양한 사용자 관련 변수가 사용 가능하기 때문입니다.

이 점을 고려할 때, 이 유형의 기능에 대한 몇 가지 다른 요청들과 유사합니다.

  1. “DM 보내기” 스크립트에 사용자의 실명 변수를 추가해 달라는 요청
  2. DM 수신자를 위한 고정 답변 변수 기능 요청

이 기능이 관심 있다면, 이 자동화에 추가되었으면 하는 템플릿 변수의 유형에 대한 더 많은 정보를 포함하여 Contribute > Feature 주제를 생성해 주시기를 권장합니다. 특정 기능에 대한 관심이 많을수록 Discourse에 포함될 가능성이 높아집니다. 흥미로운 아이디어라고 생각하며, 어떤 것을 찾고 계신지 더 알고 싶습니다. :slightly_smiling_face:

2개의 좋아요

Is it possible to use a wildcard to trigger a response for any topic that doesn’t meet any of the key pairs that you create?

Also, if multiple keywords are mentioned in the same topic, how is the response chosen?
Alphabetical, or top down?

Hi @tknospdr,

The auto responder trigger detection is designed to respond to specific regex patterns that you define in your key/value pairs. There’s no explicit feature for a “catch-all” that would trigger when no other key pairs match.

However, since the keys are evaluated as regex strings, you can create a very broad regex pattern as your last entry that would match almost any content. Something like .* would work as a catch-all regex, though this would match everything (including content that matches your other patterns).

When multiple keywords are found in a post or topic, the auto responder will respond with ALL matching responses. The responses will be posted in the same order that the key/value pairs were added or are listed in the configuration.

This means if your post contains keywords that match multiple patterns, you’ll receive multiple automated responses in the sequence they appear in your word/answer pairs list.

1개의 좋아요

Oh, that’s not good. This is for our ticketing system and I would hate to spam a customer with 2 or 3 different e-mail responses when they request help.

It would be awesome if there was a setting to:
:white_check_mark: Combine multiple key pair matches into one reply.

Until then I’ll go back to the original use case and put in the .* and use a unified generic response. Except that it would then need to only fire if {user} has not posted in {category} for {x} days.