Reputation: 1929
I have set up my Dialogflow agent with webhook fulfillment to my ASP.NET Core web service which is hosted on azure. In Visual Studio, how do I receive the agent's POST request to my service and how do I send the response? The following URL details the webhook requirements: https://dialogflow.com/docs/fulfillment .
Thanks! I know this is probably a basic question but I have never actually had any experience in receiving a POST request.
Upvotes: 3
Views: 649
Reputation: 410
If you just want to receive them on your local machine short-term for testing purposes, then after publishing to Azure you can go to Server Explorer -> App Service -> [your resource group] -> [your app], right click on your app and select "Attach Debugger"
Upvotes: 0
Reputation: 116868
In Visual Studio, how do I receive the agent's POST request to my service and how do I send the response?
Your going to have to set up some kind of IP tunneling system if you want a post from Dialogflow to show up in your local visual studio installation. Just set your dialog flow Fulfillment webhook to the tunneled endpoint. Something like ngrok.io should do the trick. Once you have things working you can deploy it to Azure and change the dialog flow Fulfillment webhook to target your azure web api.
how do I send the response?
Like you would any other web API set up
[HttpPost]
public IHttpActionResult GetProduct([FromBody] Request request)
{
// do something with request to build a proper response
var response = new ActionsResponse { ... }
return Ok(response );
}
You will of course need to set up the proper request and response formatted objects. You may also want to read up on how to create a web apiCreate a Web API with ASP.NET Core and Visual Studio for Windows
Upvotes: 2