I’m working in Dialogflow CX and messenger and I want to send different responses based on what source I get my generative answer from. If my answer is generated from a specific page I want to send a card with the response type info together with my generative answer. From what I have understood so far it is not possible to write rich content in conditional response, in the same way as you can when you use custom payload.
What about for playbooks? playbook tools to send rich content to Dialogflow CX Messenger. Is that possible because I tried going through the documentation the example is not helping
You’re correct that Dialogflow CX doesn’t allow rich content like cards to be directly included in conditional responses in the same way as with custom payloads. However, you can solve your problem by using Custom Payloads combined with Fulfillment.
Here’s how you can approach this:
Use Fulfillment for Conditional Responses: In Dialogflow CX, you can handle different response types (e.g., text, card, etc.) in the fulfillment webhook. Your webhook can check which source the generative answer came from, and based on that, return the appropriate response (text + card).
Custom Payloads for Rich Content: You can use custom payloads in your fulfillment response to send rich content like cards. The payload can include the card details (title, description, image, etc.) along with the generative text answer.
For example:
If the generative answer comes from a specific page, include the response and the card in the payload.
If it’s from another source, just send the text.
Here’s a basic structure:
{
"fulfillment_response": {
"messages": [
{
"text": {
"text": ["Here's the information I found for you."]
}
},
{
"payload": {
"richContent": [
[
{
"type": "card",
"title": "Specific Info",
"subtitle": "Details about the source page",
"image": {
"src": {
"rawUrl": "https://example.com/image.jpg"
}
}
}
]
]
}
}
]
}
}
This allows you to send the generative response and the rich content (card) based on the source. You’ll need to make sure that your webhook dynamically adjusts the payload based on the context or source of the answer.
This method provides flexibility and ensures that you can send a tailored response that includes rich content along with your text.