0

Dialogflow - Detect intents via API is not working for knowledge base intents.

I've created a knowledge base with some CSV files and enabled it. Everything working fine in Dialogflow simulation(website) but it's not at all working when send the same query using V2 API.

I've tried in V1 and V2 versions of Python and JavaScript.

1 Answers1

2

I'm not sure if this will help with your API, but I was having a similar problem using node JS.

This is because knowledge base isn't supported in V1 or V2 but only in the v2beta1. I found this link as a starting point from this thread but I think the sample code is out of date because I had to make a few changes before it started to work.

When declaring dialogFlow I used

const dialogflow = require('dialogflow').v2beta1;

From package.json:

"dependencies": {
  "dialogflow": "^0.7.0"
}

And instead of:

const sessionPath = sessionClient.projectAgentSessionPath(
  projectId,
  sessionId
);

I used:

const sessionPath = sessionClient.sessionPath(
  projectId,
  sessionId
);

because .projectAgentSessionPath was not defined as a function when I tried it.

Hope that helps!

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Dan Kaiser
  • 21
  • 1