I got a question recently on this topic.
Now this isn’t an actual answer to this specific question. Rather, I will explain the approach you should use to handle these kinds of messages in general. At the same time, I think the general answer is becoming more important now because of an important reason.
Static Rich responses for Google Assistant vs static Rich Responses in other channels
If you take a look at the Response section inside Dialogflow, you will notice something very interesting.
The number of possible Rich Responses for Google Assistant is quite a lot more than the number of possible rich responses for the other channels.
There are 10 rich responses for Google Assistant you can specify from the Dialogflow console right now:
There are only 5 such rich responses for Viber (and also the other channels, which you can verify for yourself):
Why the difference?
While I don’t know all the details about what is going on here, I think two trends caused this divergence.
The different channels started creating different kinds of rich responses
This makes sense when you think about it. Google Assistant apps run predominantly on Android phones (or usually mobile screens), so the rich responses they will support will be quite different from, say a Slack app – which is used a lot in the enterprise and on larger screen devices.
More channels came into play
For example, we have seen Dialogflow add integrations for more channels as they became available.
In case you are wondering “Is he ever going to get to the point?”, this “history of rich response support” is sort of important actually. 🙂
1 Use a custom integration
The point I am really making is – don’t use the built-in, 1-click integrations if you want to create even reasonably complex bots on other channels.
In fact, the divergence I pointed out above isn’t going to get better. It is more likely to get worse.
For example, consider all the rich responses supported by Skype bots.
Example: Skype Bot + Bot Framework
Here is the list of rich cards supported by the Skype bots:
- Adaptive Card
- Animation Card
- Audio Card
- Hero Card
- Thumbnail Card
- Receipt Card
- Signin Card
- Video Card
This list is what is “native” to the Bot Framework because the Bot Framework is most likely to be used for creating Skype based bots. If you actually used the Bot Framework to create these bots, these rich responses are much easier for you to create programmatically.
However, if you want to use Dialogflow to create a Skype bot, you will somehow need to send the correct information expected by the Skype bot (i.e. the JSON sent across should be in the correct format) so that the Skype bot can render the rich response correctly.
This distinction is very important to understand.
On the flip side, obviously if you use the Bot Framework to create Google Assistant apps then you will run into the reverse problem. The natively supported rich responses that the Bot Framework gives you will not work for creating rich responses for a Google Assistant app, so you need to figure out the JSON format to send across.
Coming back to the original point: when you use the 1-click integration, you will now have to adapt the code to do what you want. The good news is that most of this “integration code” is available as open source. The bad news is that they are usually not well supported. Usually, you are better off simply writing your own integration.
2 Figure out the JSON to send across using the custom payload
Before you write any fulfillment code in Dialogflow, first understand the exact JSON format to be sent by testing it out in the Custom Payload and triggering the corresponding intent from your bot.
3 Send the same JSON from your webhook
Once you can successfully render the correct rich response in the channel of your choice, you can then look at the exact format you used in the Custom Payload and replicate it from your webhook JSON.
Check out my free Udemy course: Zoho Deluge Script Quickstart for Programmers
This website contains affiliate links. See the disclosure page for more details.
"The magic key I needed as a non-programmer" The custom payload generator was the magic key I needed (as a non-programmer) to build a good demo with rich responses in DialogFlow Messenger. I've only used it for 30 minutes and am thrilled. I've spent hours trying to figure out some of the intricacies of DialogFlow on my own. Over and over, I kept coming back to Aravind's tutorials available on-line. I trust the other functionalities I learn to use in the app will save me additional time and heartburn. - Kathleen R Cofounder, gathrHealth