1

I started using API.AI and Dialogflow in its first versions for some small time projects. Recently I wanted to try and dive into the new V2 of Dialogflow and see how I can continue to build nice Google Assistant apps with that.

When trying to formulate a response (based on the documentation here https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/WebhookResponse) I am unable to actually render responses of any kind. Everytime I do it just gives me a webhook error back.

The intent That I'm using in my demo project is (still fairly simple as I'm just trying to get a response back):

Trending News intent editor on Dialogflow

My Webhook (Elixir based) returns the following response (actual production response):

HTTP response

When inspecting the "Show JSON" After doing the test on the right-hand side of the Dialogflow screen I receive:

fullfillmentText error

I must be doing something wrong, should the whole response that I send now be wrapped in something?

Update: When removing "fullfillmentText" and just keeping "fullfillmentMessages" I seem to get the same error, but then for fullfillmentMessages. It looks like DialogFlow doesn't understand the JSON parameters I'm sending to it. example:

enter image description here

1 Answers1

3

Man, what a typo here... Managed to fix it in the end by writing "fulfillmentMessage".

Protip for everyone starting with this and wanting to know the structure of data:

  1. Make a simple intention, just as a test
  2. Add some google or other responses trough the GUI
  3. Save the intention
  4. Trigger the intention from the "tryout now" function on the right-hand side.
  5. Click SHOW JSON to inspect how a response would need to look.

Final result Code sample:

{
  "fulfillmentMessages": [
    {
      "platform": "ACTIONS_ON_GOOGLE",
      "simpleResponses": {
        "simpleResponses": [
          {
            "displayText": "Sorry, something went wrong",
            "ssml": "<speak>Sorry, Something went wrong <break time=\"200ms\"/> Please try again later</speak>"
          }
        ]
      }
    }
  ]
}