I'm sending an Api.ai carousel message to Smooch.io but it ends up being rendered as text

453 views Asked by At

I have explored smooch.io. the format of sending rich messages to smooch.io is as follows:

{
"role": "appMaker",
"type": "carousel",
"items": [{
    "title": "Tacos",
    "description": "Description",
    "mediaUrl": "http://example.org/image.jpg",
    "actions": [{
        "text": "Select",
        "type": "postback",
        "payload": "TACOS"
    }, {
        "text": "More info",
        "type": "link",
        "uri": "http://example.org"
    }]
}, {
    "title": "Ramen",
    "description": "Description",
    "mediaUrl": "http://example.org/image.jpg",
    "actions": [{
        "text": "Select",
        "type": "postback",
        "payload": "RAMEN"
    }, {
        "text": "More info",
        "type": "link",
        "uri": "http://example.org"
    }]
}]

}

BUT when i send this JSON response through api.ai to smooch.io , it gets error. Though it easily displays simple text message. How can i send this json message as an object to smooch. Is there any way to send it like the Facebook object? All i want is to send a carousel to the user.

2

There are 2 answers

0
Cameron McGrane On

For cards\carousels we had to map api.ai json to the smooch json called by the Smooch webhook.

4
Andrew Lavers On

The Smooch API defines its own carousel JSON structure:

http://docs.smooch.io/rest/#carousel-message

The advantage of this is that Smooch can adapt this generic carousel format into any channel that support rendering them (Facebook Messenger, LINE messenger, and Telegram for example).

Update:

(Disclaimer: I work on Smooch)

What you're getting is a text-only fallback rendering of your carousel. This is what Smooch sends for channels that do not yet support it.

Carousels do not currently render fully in the Smooch Web Messenger, though it is in our backlog. The updated list of supported carousel channels can be found in the Channel Support section here: http://docs.smooch.io/rest/#carousel-message