Message formats

Text

say "His palms are sweaty, knees weak, arms are heavy" // short form
say Text("There's vomit on his sweater already, mom's spaghetti") // long form

The Text component of the Webapp channel also supports some basic Markdown:

say "He's _nervous_, but **on the surface** he looks [calm and ready](https://www.youtube.com/watch?v=_Yhyp-_hX2s)"

Typing, Wait

say Typing(1000)

Obviously, Wait is also supported (it simply does not display a typing indicator or anything for the given duration).

Image

say Image("https://images.unsplash.com/photo-1560114928-40f1f1eb26a0")

Question, Button

say Question(
"Hi! My name is:", // equivalent to title="Hi! My name is:",
buttons=[Button("What?"), Button("Who?")]
)

If you need to retrieve a specific data when clicking on either button, use the payload argument of the Button component:

say Question(
"Hi! My name is:",
buttons=[
Button("What?", payload="btn1"),
Button("Who?", payload="btn2"),
]
)
hold
say "user clicked on button with the {{event}} payload"

The Webapp channel also supports single Button components. However, as cross-channel support for single buttons is not guaranteed, we encourage you to use the standard Question component instead, with a title.

Video, Audio

The Video component supports links to mp4 files, as well as Youtube, Vimeo and Dailymotion URLs. The Audio component supports links to mp3 files, as well as Spotify, Soundcloud and Deezer URLs.

say Video("https://www.youtube.com/watch?v=lqBhgEQ4LT0")
say Audio("https://open.spotify.com/track/1xB3YT8Rakvnfcc1dp2kzJ")

Standard limitations apply: if the end user is not logged in to a valid spotify/deezer/soundcloud account, only 30s will be playable in the audio component.

For full control over the clip, prefer using a standard mp3 file URL.

Url

The Url component will automatically retrieve the target's favicon if available. If a text parameter is present, it will be used as the component's title.

say Url("https://www.wikipedia.org/", text="Visit Wikipedia")

Carousel, Card

A Carousel is essentially a collection of Card elements A single Card will display as a Carousel of 1 element. Each Card can have a maximum of 2 Button elements.

do card1 = Card(
"The Marshall Mathers LP",
subtitle="Release date: May 23, 2000",
image_url="https://upload.wikimedia.org/wikipedia/en/a/ae/The_Marshall_Mathers_LP.jpg",
buttons=[Button("Listen to this album", payload="marshallmatherslp1")]
)
do card2 = Card(
"The Slim Shady LP",
subtitle="Release date: February 23, 1999",
image_url="https://upload.wikimedia.org/wikipedia/en/3/35/Eminem_-_The_Slim_Shady_LP_CD_cover.jpg",
buttons=[Button("Listen to this album", payload="theslimshadylp")]
)
do card3 = Card(
"The Marshall Mathers LP 2",
subtitle="Release date: November 5, 2013",
image_url="https://upload.wikimedia.org/wikipedia/en/8/87/The_Marshall_Mathers_LP_2.png",
buttons=[Button("Listen to this album", payload="marshallmatherslp2")]
)
say Carousel(cards=[card1, card2, card3])

Full reference

For a complete reference of all the code presented on this page, refer to the following gist: