Ayush Agrawal
Ayush Agrawal

Reputation: 75

Launching a Follow up Intent of "YES" or "NO" With an Event from Webhook response?

I am developing api.ai bot and want to create an event that can automatically launch an intent that I had.

Scenario: I have a webhook to check whether the query parameter exists in database or not. If it exists fulfillment text will be "The data exist in the database".

But if the query doesn't exist in the database, it should reply with the "The query doesn't exist. Do you want to add it?

With this response, the followup intent "YES", "NO" should get triggered. How can I solve this?

Upvotes: 1

Views: 718

Answers (1)

Prisoner
Prisoner

Reputation: 50741

In a scenario like this, you shouldn't use followup intents (although what you're doing is, essentially, the same thing).

If the query exists, you'll reply as you've outlined.

If the query doesn't exist, you should prompt as you've indicated, but also set an Outgoing Context (for example, named "prompt-add") from your fulfillment indicating that you're prompting to add something.

Then, you'll create two intents that have this Context set as the Input Context - one that accepts "yes" like statements and one that accepts "no" like statements. Handle these in fulfillment appropriately.

Upvotes: 4

Related Questions