Here is the code. Added hardcoded values for testing.
Axios added to package.json Enabled fulfillment in Intent.
function workerHandler(agent) {
const {
name, phone, date
} = agent.parameters;
const data = [{
name: "Akash",
phone: "1234567891",
date: "5 July"
}];
axios.post = ('https://sheet.best/api/sheets/------', data);
}
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('saveData', workerHandler);
// intentMap.set('your intent name here', yourFunctionHandler);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});
Please Help.