Vadorequest
Vadorequest

Reputation: 17999

What is a Dialogflow conversation? Usage with node.js Fulfillment SDK

I am using the Node.js Fulfillment SDK https://github.com/dialogflow/dialogflow-fulfillment-nodejs and I see they allow to use a DialogflowConversation there.

I don't understand what is a DialogflowConversation, nor if/when I should use it.

Also, by reading Dialogflow Webhook Format vs. Conversation Webhook Format I feel like the Fulfillment SDK uses a conversation behind, but I'm not sure.

Could someone explain the usage of the DialogflowConversation when using the Node.js Fulfilment SDK, with an example?

Upvotes: 0

Views: 381

Answers (1)

Reza Nasiri
Reza Nasiri

Reputation: 1435

The library you mentioned is designed for developing fulfillment for Dialogflow when you have integration with various platforms(Facebook, Actions on Google, Slack, ...) but has limited built in response types.

if you want to send platform specific response that is not supported in the library, you have to create the json response in your code and then use Payload response to send the json payload.

DialogflowConversation is only available when your platform is Actions on Google which in that case you can add AoG specific responses to the conversation. the conv() method will return null if conversation is happening in any platforms other than AoG. here is an example :

 let conv = agent.conv();
 conv.ask(new BasicCard({
          text:`This is a basic card. `,
          subtitle: 'This is a subtitle',
          })
         );

 agent.add(conv);

Upvotes: 1

Related Questions