You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
I am trying to make a webhook for my chatbot I am working on. I am new to Dialogflow and it's API's This is just a learning project. I am sadly getting this error
(node:618) UnhandledPromiseRejectionWarning: Error: handleRequest must contain a map of Dialogflow intent names to function handlers
at WebhookClient.handleRequest (/home/runner/thingy/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:307:30)
at /home/runner/thingy/index.js:25:11
at Layer.handle [as handle_request] (/home/runner/thingy/node_modules/express/lib/router/layer.js:95:5)
at next (/home/runner/thingy/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/runner/thingy/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/runner/thingy/node_modules/express/lib/router/layer.js:95:5)
at /home/runner/thingy/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/home/runner/thingy/node_modules/express/lib/router/index.js:335:12)
at next (/home/runner/thingy/node_modules/express/lib/router/index.js:275:10)
at /home/runner/thingy/node_modules/body-parser/lib/read.js:130:5
(node:618) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:618) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
My code is:
constexpress=require('express')constbodyParser=require("body-parser")const{WebhookClient}=require('dialogflow-fulfillment')constapp=express()app.use(express.json())app.get('/',(req,res)=>{res.send("Server Is Working......")})/*** on this route dialogflow send the webhook request* For the dialogflow we need POST Route.* */app.post('/',(req,res)=>{// get agent from requestletagent=newWebhookClient({request: req,response: res})// create intentMap for handle intentletintentMap=newMap();entit// add intent map 2nd parameter pass functionintentMap.set('webhook-demo',handleWebHookIntent)// now agent is handle request and pass intent mapagent.handleRequest(intentMap)})functionhandleWebHookIntent(agent){agent.add("Hello I am Webhook demo How are you...")}/*** now listing the server on port number 3000 :)* */app.listen(3000,()=>{console.log("Server is Running on port 3000")})
0
I am trying to make a webhook for my chatbot I am working on. I am new to Dialogflow and it's API's This is just a learning project. I am sadly getting this error
My code is:
Note: Not all my code, just had one tweak
Code Source: https://www.kommunicate.io/blog/integrate-dialogflow-nodejs/
The text was updated successfully, but these errors were encountered: