Below is the complete code which i am running to show the table in google assistant.
'use strict';
const {Table} = require('actions-on-google');
process.env.DEBUG = 'dialogflow:debug';
exports.dialogflowFirebaseFulfillment =
functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
function showTable(){
const conv = agent.conv();
agent.add("this is sample table");
agent.add(new Table({
dividers: true,
columns: ['header 1', 'header 2', 'header 3'],
rows: [
['row 1 item 1', 'row 1 item 2', 'row 1 item 3'],
['row 2 item 1', 'row 2 item 2', 'row 2 item 3'],
],
}));
}
let intentMap = new Map();
intentMap.set('TableView',showTable); //TableView is my intent name
agent.handleRequest(intentMap);
});
While running the above code its showing me an below error
TypeError: Table is not a constructor
at showTable (/user_code/index.js:74:15)
at WebhookClient.handleRequest (/user_code/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:303:44)
at exports.dialogflowFirebaseFulfillment.functions.https.onRequest (/user_code/index.js:102:9)
at cloudFunction (/user_code/node_modules/firebase-functions/lib/providers/https.js:57:9)
at /var/tmp/worker/worker.js:735:7
at /var/tmp/worker/worker.js:718:11
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)