Text cards
meya.text_suggestions
Outputs text and suggested responses. Renders on each integration differently, depending on the specifications of the integration (e.g. on Messenger suggestions are buttons, on Kik they are keyboard suggested responses).
Property | Description | |
---|---|---|
text | the text to output | Required |
suggestions | a list of suggested responses | |
mode | either |
|
passthru | automatically advance without waiting on user |
|
block | treat any non-button press as a user input. This will trigger the |
|
output | the key used to store the data for subsequent steps in the flow |
|
scope | where to store the data. One of flow, user, bot. |
|
Example of text with suggestions used in flow and a custom component.
Handling non-button presses
If you want your bot to listen for any input other than buttons, see this example.
component meya.text_suggestions
properties
text What is your favorite elelphant?
mode quick_reply
suggestions
African Elephant
Asian Elephant
Woolly Mammoth
from meya.cards import TextWithButtons, Button
text = 'What is your favorite elelphant?'
buttons = [
Button(text='African Elephant'),
Button(text='Asian Elephant'),
Button(text='Woolly Mammoth')
]
card = TextWithButtons(text=text, buttons=buttons, mode="quick_reply")

meya.text_buttons
Similar to meya.text_suggestions. Uses buttons instead of suggestions.
Property | Description | |
---|---|---|
text | the text to output |
|
buttons | an array of Buttons | |
mode | either |
|
passthru | automatically advance without waiting on user |
|
block | treat any non-button press as a user input. This will trigger the |
|
output | the key used to store the data for subsequent steps in the flow |
|
scope | where to store the data. One of flow, user, bot. |
|
Example oftext_buttons
used in a flow - YAML + Python
component meya.text_buttons
properties
text What is your favorite elelphant?
mode buttons
buttons
text African Elephant
action next
text Asian Elephant
action next
text Woolly Mammoth
action extinct
from meya.cards import TextWithButtons, Button
text = 'What is your favorite elelphant?'
buttons = [
Button(text='African Elephant', action="next"),
Button(text='Asian Elephant', action="next"),
Button(text='Woolly Mammoth', action="extinct")
]
card = TextWithButtons(text=text, buttons=buttons, mode="buttons")
message = self.create_message(card=card)
Exampletext_buttons
with transitions
states
text_buttons_state
component meya.text_buttons
properties
text Pick your favorite football player
output player
buttons
text Lionel Messi
action messi
text Cristiano Ronaldo
action ronaldo
transitions
messi messi_state
ronaldo ronaldo_state
messi_state
component meya.image
properties
image_url'https://upload.wikimedia.org/wikipedia/commons/f/f2/Lionel_Messi.png'
returntrue
ronaldo_state
component meya.image
properties
image_url'https://upload.wikimedia.org/wikipedia/commons/d/d5/Cristiano_Ronaldo_20120609.jpg'
returntrue
Updated 18 days ago