Я включил выполнение. И вот так выглядит мой файл index.js:
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function welcome(agent) {
agent.add(`Welcome, I am agent. What is your name?`);
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
function funtion_name(agent){
let x = agent.parameter.self_defined_identity;
if(x=='something'){
agent.add('WOW');
}
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('Intent_name',function_name);
// intentMap.set('your intent name here', yourFunctionHandler);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});
Он работает до тех пор, пока значение, которое должно вызвать 'intent_name', не будет входным. При вызове этого намерения выдается эта ошибка:
Failed to parse Dialogflow response into AppResponse because of invalid platform response: Could not find a RichResponse or SystemIntent in the platform response for agentId: 12628eb5-d7af-48f9-b013-2e1607d77018 and intentId: 622559ad-9408-4e45-ab01-669528b7f227.
Пожалуйста, помогите.