1
votes

I created a V2 agent that makes a DialogFlow webhook for one of my intents. I receive the webhook in my server code but I'm not sure how to respond to it. I can't find the URL I need to make the response back as well the authentication or other info needed to associate my response to the original webhook request.
I'm using Python in a custom app to respond. Does anyone know where I can find this information?

I've looked through the following documentation, and more:

1

1 Answers

4
votes

You don't need an end-point to respond to webhook requests. You just need to return a response from the webhook in a proper format which your dialogflow agent is expecting. Dialogflow agent will be able to map it to correct request based on responseId which it sends with the request.

Suppose, you got a webhook request in your python app :

req = {'responseId': 'f8vaj49u-10i8-49c1-8491-8ac491e84918', 'queryResult': {'queryText': 'how are you doing', 'parameters': {}, 'allRequiredParamsPresent': True, 'fulfillmentText': 'Wonderful! Thanks for asking.', 'fulfillmentMessages': [{'text': {'text': ['Wonderful! Thanks for asking.']}}], 'intent': {'name': 'projects/agent_name/agent/intents/########', 'displayName': 'smalltalk.greetings.how_are_you'}, 'intentDetectionConfidence': 1.0, 'languageCode': 'en'}, 'originalDetectIntentRequest': {'payload': {}}, 'session': 'projects/agent_name-sit/agent/sessions/session-id'}

You want to perform some logic and build a response yourself, or add a context based on some logic or anything else.

response = json.dumps({
    'fulfillmentText': 'response from webhook'
    })
return response

You can check the fulfillment request and fulfillment response in the Diagnostic Info which you can access from bottom right corner of Dialogflow console when you send a test request from the console.