Azka Gilani
Azka Gilani

Reputation: 61

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

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.

Upvotes: 2

Views: 459

Answers (2)

Cameron McGrane
Cameron McGrane

Reputation: 4945

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

Upvotes: 0

Andrew Lavers
Andrew Lavers

Reputation: 8141

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

Upvotes: 1

Related Questions