Let's create a story with a webhook that returns responses

Webhooks allow your bot to send and receive data to external internet APIs.




































Last updated
{
"responses": [],
"memory": {},
"user_attributes": {},
"quickreplies": [],
}{
"responses": [
"Here's your random number: 20"
]
}{
"memory": {
"favourite-thing": "cars"
}
}{
"user_attributes": {
"age": "28"
}
}{
"quickreplies": [
"Chicken",
"Fish",
"Vegetarian",
"Vegan"
]
}{
"type": "image",
"url": "<IMAGE_URL>"
}{
"responses": [
{
"type": "image",
"url": "https://www.worldatlas.com/upload/6b/40/33/community-development-councils-map-of-singapore.png"
}
]
}{
"type": "text",
"text": "<TEXT_RESPONSE>",
"buttons": [
{
"type": "<postback|web_url>",
"title": "<BUTTON_TITLE>",
"payload": "<POSTBACK_PAYLOAD>", // required if type is "postback"
"url": "<WEBSITE_URL>" // required if type is "web_url"
}
]
}{
"responses": [
{
"type": "text",
"text": "How would you rate your experience with us?",
"buttons": [
{
"type": "postback",
"title": "π Like",
"payload": "rating_like_user_227323"
},
{
"type": "postback",
"title": "π Dislike",
"payload": "rating_dislike_user_227323"
},
{
"type": "web_url",
"title": "π Learn More",
"url": "https://mywebsite.com/about-our-rating-system"
}
]
}
]
}{
"type": "cards",
"elements": [
{
"image_url": "<IMAGE_URL>",
"title": "<TITLE>",
"subtitle": "<SUBTITLE>",
"buttons": [
{
"type": "<postback|web_url>",
"title": "<BUTTON_TITLE>",
"payload": "<POSTBACK_PAYLOAD>", // required if type is "postback"
"url": "<WEBSITE_URL>" // required if type is "web_url"
}
]
}
],
"image_aspect_ratio": "<original|horizontal|square>", // If a messaging app supports it, display cards in a different aspect ratio
"page_limit": 8 // defaults to 8
} {
"responses": [
{
"type": "cards",
"elements": [
{
"image_url": "https://www.foodandwine.com/thmb/R29hsuwfvCakNb9E7htyI8fgfrc=/750x0/filters:no_upscale():max_bytes(150000):strip_icc():format(webp)/florentine-butter-chicken-ft-recipe0919-3fef0bddd6614a70b2fe450c11298acb.jpg",
"title": "Florentine Butter Chicken",
"subtitle": "Butter Chicken from Florence with a twist π",
"buttons": [
{
"type": "postback",
"title": "Order",
"payload": "addcart_florentinebutterchicken"
},
{
"type": "web_url",
"title": "Learn More",
"url": "https://www.foodandwine.com/travel/europe/italy/italian-main-dishes/florentine-butter-chicken"
}
]
},
{
"image_url": "https://www.foodandwine.com/thmb/g-2_63IdHag2p5Ayhcw2KI04svI=/750x0/filters:no_upscale():max_bytes(150000):strip_icc():format(webp)/farro-mafaldine-with-black-truffle-butter-and-mushrooms-FT-RECIPE1220-71c4d864d58f42b1a1addd91572c9e47.jpg",
"title": "Truffle Faro Pasta",
"subtitle": "Pair creamy butter, nutty farro pasta, and a fortifying mix of wild mushrooms π",
"buttons": [
{
"type": "postback",
"title": "Order",
"payload": "addcart_trufflefaropasta"
},
{
"type": "web_url",
"title": "Learn More",
"url": "https://www.foodandwine.com/travel/europe/italy/italian-main-dishes/truffle-faro-pasta"
}
]
}
]
}
]
}{
"type": "document",
"url": "<DOCUMENT_URL>",
"name": "<DOCUMENT_NAME>.<FILE_EXTENSION>"
}{
"responses": [
{
"type": "document",
"url": "https://worldofwarships.eu/dcont/fb/document/e7d8b942-142f-11ef-9f3c-b49691e6ead0.pdf",
"name": "Contest Conditions.pdf"
}
]
}{
"type": "audio",
"url": "<AUDIO_URL>",
"name": "<AUDIO_NAME>.<FILE_EXTENSION>"
}{
"responses": [
{
"type": "audio",
"url": "https://science.nasa.gov/wp-content/uploads/2024/03/48520_E1-PIA26041-The_Sound_of_MOXIE_at_Work_on_Mars.wav",
"name": "Secret Code.wav"
}
]
}{
"type": "video",
"url": "<VIDEO_URL>",
"name": "<VIDEO_NAME>.<FILE_EXTENSION>"
}{
"responses": [
{
"type": "video",
"url": "https://i.imgur.com/UDWU7r7.mp4",
"name": "Unboxing Camera.mp4"
}
]
}