CSML is able to handle many types of messages by default, and can be extended to accommodate any number of custom types as well (feature documentation pending).
To send a message to the end user, simply use the keyword
say followed by the message type you want to send.
somestep:say "I'm a text message"say Wait(1500)say Text("I'm also a text message")say Typing(1500)say Url("https://clevy.io")say Image("https://media.giphy.com/media/ASd0Ukj0y3qMM/source.gif")say Video("https://www.youtube.com/watch?v=DLzxrzFCyOs")say Audio("https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/253508261")say Question(title = "What is love?",buttons = [Button("baby don't hurt me"),Button("don't hurt me"),Button("no more")])
Below is a list of default valid message components, which are automatically converted to nicely formatted messages for the channel in which the user is talking with the bot.
Output a simple string (with no styling attached). This is also the default type, alias of
Display a typing indicator for
Url(string, text="text", title="title")
Display the image available at URL
Display the video available at URL
Display the audio available at URL
Question(title = string(, buttons = [Button]))
Display a list of buttons with a header of
Text(string) + list of buttons
* the content of the parameter may be modified to accommodate the target channel requirements
A conversation with a chatbot is not very different from a human-to-human dialogue: sometimes the user talks, sometimes the bot talks.
CSML provides a solution when you need the chatbot wait for the user's input: using the
hold keyword, the chatbot will remember its position in the conversation and simply wait until the user says something, then continue from there.
somestep:say Question("Do you like cheese?", buttons=[Button("yes"), Button("no")])holdif (event == "yes") say "I'm glad to know that you like cheese!"else say "Oh that's too bad!"