0

I'm using Dialogflow Messenger integration. Custom Payloads are working from the Dialogflow platform, but I don't know how to use them from Webhook.

Here is my JavaScript code that doesn't works:

const functions = require('firebase-functions');
const { dialogflow } = require('actions-on-google');
const { Card, Suggestion } = require('dialogflow-fulfillment');
const { WebhookClient } = require('dialogflow-fulfillment');
const app = dialogflow();

const response = {
  "fulfillment_messages": [{
    "payload": {
      "richContent": [
        [{
          "type": "chips",
          "options": [{
            "text": "Empezar!"
          }]
        }]
      ]
    }
  }]
}

const numero = (conv) => {
  conv.ask(response);
};

app.intent("numero", numero);
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

The intent is detected correctly but the code for the rich response is not working, the chatbot response is: 'Cannot display response in Dialogflow simulator. Please test on the Google Assistant simulator instead.'. I want to know how to use all possible custom payloads (Info response, Description response, Button response...).

A. Asensio
  • 25
  • 5

1 Answers1

1

Your JSON response in the webhook should be-

const response = {


  "fulfillment_messages": [{
    "payload": {
      "richContent": [
        [{
          "type": "chips",
          "options": [{
            "text": "Empezar!"
          }]
        }]
      ]
    }
  }]

}

Your response on dialogflow messenger would look like

Here is another stackoverflow post that might help- How to show Rich Response Buttons (''Chips) Using Dialogflow Fulfillment?

Ajin28
  • 11
  • 2
  • Is not working, it says: _Cannot display response in Dialogflow simulator. Please test on the Google Assistant simulator instead._ I edited my post with the full code. – A. Asensio Mar 01 '21 at 11:00
  • Hey A. Asensio, did you get the solution for this. getting the same error "Cannot display response in Dialogflow simulator. Please test on the Google Assistant simulator instead." – Vikas Patidar Aug 09 '21 at 13:23