Aditya Ekbote
Aditya Ekbote

Reputation: 33

Conversation ends after fulfillment?

I have been trying out the Actions on Google with Api.AI . I have written a simple nodejs webhook using their Github sample: dialogflow-silly-name-maker-webhook-nodejs .

The thing is i don't want the agent to end conversation after the fulfillment of a request. I have not checked the END CONVERSATION box in the Intent on API.AI .

One more requirement i had was how can i remember the parameters asked during one intent, so that the same can be used for the next intent. Is this possible yet?

Upvotes: 3

Views: 1245

Answers (2)

Leon Nicholls
Leon Nicholls

Reputation: 4646

The Actions on Google client library provides a 'data' field to store values during a user session. For example, your action logic can do:

assistant.data.answer = 10;

To make this work, the client library is using the API.AI support for contexts, but the 'data' field is a convenience so you do no have to know the technical details. During the next incoming request to your action logic, you can then retrieve the stored session value using the same 'data' field:

let previousAnswer = assistant.data.answer;

If you want the user to respond during a conversation use the client library 'ask' method:

assistant.ask('Welcome to My Action! Say a number.');

If you want to end the conversation, use the client library 'tell' method:

assistant.tell('Ok, see you next time.');

Upvotes: 1

Prisoner
Prisoner

Reputation: 50701

You're probably using assistant.tell() to send the reply. No matter what the setting is in api.ai, this will end the conversation.

Use assistant.ask() instead - this will keep the conversation open.

To use parameters between questions you'll probably want to use api.ai's contexts.

Upvotes: 4

Related Questions