I have a Dialogflow chatbot. In the Dialogflow internal tester everything works fine, but in the version displayed on facebook I cannot get the cards or suggestions. Even when I replace them with code from another working chatbot.
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion, Payload} = require('dialogflow-fulfillment');
var answers = [];
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
function welcome(agent) {
agent.add('Hi! Do you want to discover your lockdown personality?');
agent.add(new Card({
title: '1. How has the COVID-19 crisis',
imageUrl: 'https://ejoy-english.com/blog/wp-content/uploads/2018/08/shutterstock_524250877-e1496428580440.jpg',
text: 'impacted the stability of your life?',
})
);
agent.add(new Suggestion("1 more exasperated and hopeless"));
agent.add(new Suggestion("2 less freaked out than other people"));
agent.add(new Suggestion("3 More calm and hopeful"));
agent.add(new Suggestion("4 More scared and panicked"));
agent.add(new Suggestion("5 More surprised and baffled"));
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
agent.handleRequest(intentMap);
});
Here's what I get on Facebook:
And in the Dialogflow's inernal tester:
It's working well on Slack and I managed to do another chatbot which use rich messages as well without using JSON payload and it worked well on messenger. I don't know why can't rich messages be displayed in Messenger with this specific chatbot.