When you create variables, constants, or entities in your chatbot, you can add them to chatbot message content by typing @. A list of available placeholder chips is displayed. You can either select from the list, or keep typing the name of the variable, constant, or entity to narrow the list.
Each type of placeholder works differently in your chatbot content:
Adding constants
Constants can be used in chatbot messages such as text, buttons, Quick Replies, and script parameters, in logic conditions, and can be also set as the value of variables using actions or retrieved by scripts. When you use a constant, the same value is shown to every user in every conversation. Constants don't need to be set during the conversation and are always available.
Constants can't be used in NLP training phrases.
Adding variables
Variables can be used in chatbot messages such as text, buttons, Quick Replies, and script parameters, in logic conditions, and can be also set as the value of other variables using actions. Variable values are specific to each user, based on their interaction with your chatbot. Variables cannot be used in NLP training phrases.
Variables must have a value saved by an action or a script during in the conversation flow before they are used in chatbot content, or be configured with a default value. If a variable does not have a default value and has not been set when your chatbot tries to use it:
- In a message or button with other text or emojis: the variable value is blank.
- In a message or button with no other text or emojis: the chatbot displays an error message of Error: no content.
Variables can have expiry times to control how long the value is stored. The timer starts when the variable value is saved, and once the time has elapsed, the variable is reset to its default value (or blank, if it has no default).
If a variable does not have an expiry time, once a variable value is set for a user, it remains for the chat session until it is reset or set to a different value by another action or script. If your user is using an asynchronous channel, the variable values are kept for their next chat session. If your user is using a synchronous channel, the variable values are reset to their default (or blank if the variable has no default value) when they start their next chat session.
When using a variable:
- Write your content so that it will not seem unusual if the variable value is blank or uses its default value.
- Be cautious when creating messages or buttons with only a variable as the content.
- Ensure the variable value is set in the conversation flow before the user reaches this passage, or use a default value.
- Make sure you test your variables before you publish.
Adding entities
Entities can be used in NLP training phrases to extract key terms from your user's responses. Entities can't be repeated within training phrases: if a training phrase needs the same synonym more than once (such as two cities or airports a user is travelling between) separate entities must be created for each time the synonym appears in the training phrase.
Entities can also be used in chatbot messages such as text, buttons, Quick Replies and script parameters, in logic conditions, and retrieved by scripts, but only in passages where the incoming question has used the entity.
When you use an entity in chatbot message content, it will be replaced with the term the user used when they asked the question. If the user arrived at this passage without triggering a question that used that entity, the entity value will be blank.
Once the conversation flow moves on from this passage, the entity value will no longer be available. If you want to be able to access the value later in the conversation flow, use an action to set a variable using the entity.
Comments
Article is closed for comments.