1

I’m new to Dialogflow CX and after reading its node.js documentation (I’m a jr Dev) I’m still struggling to get the problem below solved.

PROBLEM: I need my chatbot to receive the question “do you have Toyota Corollas (cars!) in black with less than 20,000 miles, 2017 or newer and cheaper than $15,000 for sale?”

CONTEXT: I have a database with all car makes, models, years, versions, mileage, colors and prices available. The problem is that I can’t (and sorry for how silly this looks) even initiate the bot and I know that after initiating it I would need to create a zillion entities through code (can’t do it manually) so the bot would be able to read all car parameters of the user’s question. Then after reading those parameters (entities) the bot should query my database to check availability of those particular Corollas and then give a proper answer.

ASK: I would be very grateful if you could please help me initiate the Dialogflow CX bot, load all car makes, models, years, versions, colors and prices into it AS ENTITIES and then give the answer that the user needs.

I’ve checked the GitHub quickstarts and read the documentation multiple times but am still very confused.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
DiF
  • 503
  • 1
  • 5
  • 10

1 Answers1

1

It looks like you have a few different issues with some of the Dialogflow CX basics. Let's try to clear them up.

How do I initiate the Dialogflow CX bot?

It isn't clear what you mean, exactly, from this.

Dialogflow CX, itself, isn't a bot client. Instead, it provides integrations with various ways to communicate with your agent. This may include telephone integrations, web-based chat systems, and an API so you can integrate with other clients such as Slack.

Your Dialogflow CX agent, itself, is setup using Google's Cloud services, and can support one or more of these integrations.

How do I create a zillion entities through code?

It isn't clear why you need to create a zillion of them, nevermind through code itself.

You likely will want to create a custom entity type for the make/model combination. And it should probably have aliases, so that people could say "Ford Explorer" or just "Explorer" and have it resolve to the same type.

If you really wanted to use an API to do this, you could use EntityType.create to do so. That points to the REST documentation, but based on the language you want to use, there may be a library able to handle it.

Some of the other types, however, can be handled with system entity types such as @sys.color or a numeric type. There's no reason for you to create those.

But what happens if someone asks for a combination that isn't valid?

Then you'll need to tell them it isn't valid. Just like if someone was talking to you in person and asked for something that didn't make sense.

How will it check the database for a good response?

You'll need to make this database call as part of a webhook that you create to implement the business logic.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Thanks a lot for your kind attention here. I wasn't clear sorry. I know that DCX is basically a library that allows us to programmatically do stuff with our bot and connect to a ton of things. I've done the setup on VSCode (i.e. authorized GCP, authenticated) but I can't do a simple 'hello world' from VSCode. Can you help me perhaps understand how to launch from VSCode this simple hello world that 1) creates a session, 2) feeds some intents and entities to my bot and 3) reacts to a user's message depending on the detected intent and on the parameters retrieved? Then I should be good to go. – DiF May 02 '21 at 03:39
  • And is there a way to find knowledgeable people like you to help with paid teaching? 2hrs over Zoom would do and I really need to accelerate my learning on this. – DiF May 02 '21 at 03:41
  • Ok I was able to have my code run (small step, but happy one)! The code can be found on https://github.com/googleapis/nodejs-dialogflow-cx/blob/master/samples/list-intents.js The problem now is that line 36 ('const parent = client.agentPath(projectId, location, agentId);') throws the error 'Cannot read property 'toString' of undefined' even though projectId, location and. agentId are console.logging fine. Any ideas? Terminal doesn't show anything else but this message. Thank you. – DiF May 05 '21 at 06:36
  • This sounds like a different issue, and I suggest you open a new question, showing all the code you're using, the error, and any other information that may help diagnose what is going on. If this answer has helped - accepting and/or upvoting it is always appreciated. – Prisoner May 06 '21 at 21:05