Adarsh Trivedi
Adarsh Trivedi

Reputation: 582

Simple chat bot with a single context matching api.ai?

I want to do some thing like this with api.ai. I am doing it as a telegram bot.

1st question: Tell me a joke?

Bot: Tells a joke ( picks it from text response that I specified )

2nd input from user: Some more.

Bot: It should tell another joke from the same list of responses.

One thing I could do is include MORE as a user input is joke intent and it would pick a response.

But I can not do this, because then even without asking 1st question if I give "more" as input it would pick a response from the list. Basically that wouldn't pick response based on context.

Any help onn the structure I should be using on api.ai to achieve something like this.

Upvotes: -1

Views: 162

Answers (1)

AiDev
AiDev

Reputation: 1234

So the first intent where the user asks "tell me a joke?" sets an outgoing context- 'jokes'.

Follow-up intents for telling more jokes have 'jokes' for the incoming context, and, if you want to chain repeatable requests, set the outgoing context as 'jokes' as well.

If the user input like "tell me more" outside the 'jokes' context is still triggering the followup intent, either train your bot to recognize the difference, or create an explicit "tell me more" example in a fallback intent outside the jokes context.

Upvotes: 1

Related Questions