Match a statically defined button ID in a button click event.
- button_id: agent_escalation
when: true
This will match any button.click event where
the button ID is set to agent_escalation
.
You can define a static button ID as follows:
steps:
- say: How can I help you?
quick_replies:
- text: Questions about credit cards
action:
flow: flow.credit_cards
- text: Talk to an agent
button_id: agent_escalation
When the user clicks the Talk to an agent
quick reply, it will create
new button.click event with the button ID
set as agent_escalation
. This will then match the button trigger above.
Note, that the trigger's when
field is set to true
, which means tha the
trigger will always evaluate, event when the conversation thread's mode isn't
bot
. Check the when section in the triggers guide
for more info on when triggers are evaluated.
Check the triggers guide for extra info.
Element details
type: meya.button.trigger
class: ButtonTrigger
path: /meya/button/trigger/trigger.py
signature: button_id
Fields
field | description | required | signature | default | type |
---|---|---|---|---|---|
spec | Override the original spec for this element. | ○ | ○ | null | Spec |
bot | Bot used to evaluate this trigger. | ○ | ○ | null | BotRef |
action | Action executed if this trigger matches. Check the trigger action guide for more info. | ◉ | ○ | TriggerActionEntry ActionComponentSpec | |
when | Optionally set the criteria when this trigger should evaluate. The default is true and will always evaluate. | ○ | ○ | true | typing.Any |
confidence | Override the default confidence with a custom value for trigger matches. | ○ | ○ | null | Real |
button_id | The static button ID to match against. Use this button ID in the button_id field in the relevant quick replies and buttons. | ◉ | ◉ | str | |
text | DEPRECATED | ○ | ○ | null | str |
Usage reference
Basic
triggers:
- button_id: STRING
steps:
- say: STRING
Full
type: meya.button.trigger
spec:
type: STRING
data:
STRING: ANY
timeout: 123
trigger_when: ANY
bot: element.name
action: COMPONENT
when: ANY
confidence: 123
button_id: STRING
text: STRING