I am using my own platform for publishing chatbots. I am able to use fullfilment for sending simple messages like agent.add('message'), but when I try to send customPayloads I am having problems. Problem is that platform-field is required, but my agent.requestSource field is null.
Here is my fullfilment code:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Text, Card, Image, Suggestion, Payload} = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
function test_intent(agent) {
agent.add('This message works'); // THIS WORKS
agent.add('Source: '+ agent.requestSource); // THIS GIVES: "Source: null"
agent.add(new Payload(agent.ACTIONS_ON_GOOGLE, {
"action" : {
"buttons": {
"title": "title",
"buttons": [
{
"text": "text 1",
"value": "value 1"
},
{
"text": "text 2",
"value": "value 2"
}
]
}
}
})); // THIS DOES NOT WORK
}
let intentMap = new Map();
intentMap.set('0_Test_intent', test_intent);
agent.handleRequest(intentMap);
});
I am using my own platform for publishing chatbots. I am able to use fullfilment for sending simple messages like
agent.add('message')
, but when I try to send customPayloads I am having problems. Problem is that platform-field is required, but my agent.requestSource field is null.Here is my fullfilment code:
How should I define platform for payload?