Setting Up Keyword Triggers

Updated on January 20, 2022

Triggers is where you can set up the logic to capture keywords/recognisable patterns using regex, or entities.

To get Triggers, go to “Editor” along the side navigation bar, click on “Triggers” under “Nodes”:

How do I set up a keyword trigger? #

  1. To start, you may click on the “+” icon to create a trigger. Name the trigger in the text box.
    For triggers that belong to the same category, add an underscore (“_”) between the words, e.g. ‘feedback_name’, ‘feedback_email’.  When you view the feedback category in the triggers list, you will be able to view all triggers relating to feedback.
  2. Or select an existing trigger to update it.

The orientation of the Trigger interface: #

1. Trigger Name: Click on this to amend the trigger name.
2. Save or Delete function: Click on the icon to save the current trigger and click on the to delete the current trigger.
Note: Delete is immediate, there won’t be any prompt.

3. Basic Editor: Add the relevant conditions (e.g. App Source) here, or select the relevant Trigger type (e.g. Email for email validation or Entity for entities detection)

4. Keywords: Enter the patterns of the keywords to look for, using Regular Expressions or regex. You may refer to the next section for simple tips or try out your regex here:

Priority: Higher value implies that chatbot will go through this trigger first before the other triggers of lower values.

Context: Fill in the content node name that the trigger will be checking from. Leave this blank if your trigger is a global trigger, or a trigger to capture the keyword patterns regardless of the context.

5. Add Positive test: To test your keyword captures, you may add your keywords here to test. A green tick at the side means that the keyword/phrase is captured. A red cross means that it is not being captured.

Add negative test: This is to test for invalid input. A green tick at the side means that the keyword/phrase will not be captured by this trigger, whereas a red cross means that your input will be captured by this trigger.

6 . Event: Event is the action of the chatbot when the conditions above have been fulfilled. Use goto to lead the chatbot to a defined content node, or set it to capture data if you have the context to capture and store in the database.

Data: If the event is “goto”, fill in the content node name to lead to when text pattern has been matched.

Trigger type #

  1. After selecting “Text”, you can key in the regex or patterns to capture under “Keywords” field.
    1. By default, /./i will be filled here. This refers to catch-all, where any input from the user will be captured by this pattern.
    2. Replace the “.” With keywords that you want to capture, and separate each keyword by “|”, e.g. /hello|hi/i. This expression will capture the keywords defined when it appears in any part of the sentence. In the example here, as long as “hi” or “hello” appear in a sentence, this trigger will be activated. For example, “Hi” or “Hello, I am chatbot”.
    3. To restrict your trigger even further, add a “^” sign at the front and “$” at the back of the keyword(s), i.e. /^hello$/i. For multiple keywords, remember to add the “|” sign in between the keywords and a bracket around them, i.e. /^(hello|hi)$/i. This regex is to capture only the keywords “hello” or “hi”.
  2. Simple Mode function: Toggle to Simple Mode to add keywords directly, instead of defining using regex (Advanced Mode). You can select the relevant conditions to your keywords.
  3. Select “Entity” under Trigger type if you would like to use the entities you have created under the Entities function. Click on “+ Entity” icon and you can select the relevant entity, operator and the entity value(s):

Validation Check #

  • If the trigger has the same conditions, same context, and same text patterns, it will be flagged as duplicated:
  • Text patterns should not be wrongly configured to be “open ended”.  When a trigger is left “open ended”, all values would be a valid value, causing the chatbot to be misconfigured.
    An “open ended” example: “/hello|hi|yes|/i”
  • Do note and review your regex when the “Invalid regular expression” message appears.
  • Do not leave your keywords as a catch-all expression if your trigger does not have any context (i.e. Context field is blank). This will cause all text input to be captured by this trigger, and the chatbot will be misconfigured.
Did we help you?

Learn more about KeyReply

To see our Conversational AI in action, sign-up for a guided walk-through and see how our platform can be tailored for your organization’s needs