0

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?

Vadorequest
  • 16,593
  • 24
  • 118
  • 215

1 Answers1

1

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);
Reza Nasiri
  • 1,360
  • 1
  • 6
  • 19
  • What's the point of using the `conv` with Actions on Google? I can send `Suggestions` without having to use a conv, I don't get the point of the feature since I feel like I can achieve the same results without using it. – Vadorequest Dec 01 '18 at 21:00
  • 1
    Text, Cards, Images and Suggestion are the only responses that you can send without having to construct a json payload for now. Actions on Google supports other response types that are not supported and are easier to build using conv object. you can find the list of AoG responses [here](https://developers.google.com/actions/assistant/responses) – Reza Nasiri Dec 01 '18 at 23:17