Reputation: 1929
What is the Dialogflow webhook format? I want to capture the data in an MVC controller and then respond to the webhook whilst maintaining context. How do I do this in C# with the Dialogflow v2 client library? I haven't found any examples to follow in this language and am unsure how to capture the data.
Upvotes: 2
Views: 3150
Reputation: 50701
The "Dialogflow V2 client library" is for people who are writing clients that send requests to Dialogflow. Dialogflow calls this a "Detect Intent Request", since you're sending a text string (or audio stream) to Dialogflow and it will determine and process the Intent.
If you're interested in building a Fulfillment webhook that is called when an Intent is matched, then you want to look at the Dialogflow Fulfillment API, which is different. There is no supported library for C# yet, but you can parse and return the JSON. The JSON for V1 and V2 are slightly different (mostly in the names of the fields used, but also occasionally in what the values should be).
You can see the fields for the JSON as well as several examples of the request and response formats. There was also an article on Medium recently posted by a Google Developer Relations member discussing using C# for fulfillment in Dialogflow.
Upvotes: 3
Reputation: 1572
You can read more about Dialogflow webhook format here. Regarding the Dialoglow v2 client library, it is specifically stating that you don't need to use it and can answer in JSON instead using JObject
.
If you want to use Protobuf
to lower the overhead and save some traffic you will have to use utilities from idiomatic cloud libraries described in the previous link.
Upvotes: 3