Derek
Derek

Reputation: 85

My Action and webhook works fine as a draft, but fails after submitting to production

I have created an Action on Actions for Google. It uses Dialogflow to process inputs, and is powered by a PHP webhook. The PHP script is hosted by a 3rd party hosting provider. I'm using v2 of the Dialogflow API.

The agent works successfully in Dialogflow with no issues.

Initially, when testing in the Actions on Google simulator it worked fine.

After submitting my draft action for review, the prodution version did not work. However, reverting back to the draft version it continued to work fine. Consequently, my review submission is rejected.

In the errors tab of the console simulator, it tells me "MalformedResponse 'final_response' must be set." In the 'response' tab it shows the response below:

enter image description here

I have been in contact with support who provided the following suggestions:

  1. Clear my cache and try again

    • Not surprisingly this made no difference
  2. Remove authentication from the script

    • Server authentication was in place
    • Credentials were configured in Dialogflow and the webhook could be accessed
    • This did not seem to be the issue, however I have removed authentication from the script and removed the credentials from Dialogflow
  3. Webhook is returning an empty response

    • It's not. Sample of the JSON response is provided above (at this point it was only providing fulfillmentText)
  4. Response needs to include a Google payload

    • Added the Google payload which now passes textToSpeech and displayText as a simpleResponse
  5. Check you're using v2 of the API

    • I am, this is set in Dialogflow
  6. Could potentially be a result of this known issue

    • However, based on the mixed messaging I've been provided I'm not convinced this is the case

Does anyone have any ideas or suggestions on what else might be causing the issue?

Upvotes: 0

Views: 105

Answers (2)

Derek
Derek

Reputation: 85

For anyone who has a similar issue in the future, I have found the cause.

My PHP script takes the session ID passed from Actions on Google and uses that to set the PHP session_id.

The length of the session ID during testing was 81 characters. The production version passes a session ID which is 148 characters long. The limit for a PHP session_id is 128 characters, so this was causing the script to fail.

Removing this line of code causes issues, because PHP doesn't seem to consistently allocate a session_id during a single conversation which can cause unusual results. Instead, I am hashing the Actions on Google session using sha512 resulting in a 128 character value. I am using this to set the PHP session with no issues.

Upvotes: 0

Sarah Dwyer
Sarah Dwyer

Reputation: 529

First, make sure you have the webhook enabled toggle on for all your intents and also make sure that if your fulfillment has a promise ensure that the promise is being returned. Alternatively, if you aren't using fulfillment webhook then you need to make sure to have defined a static default response for these intents. You can read more about all of this here in the Dialogflow docs.

Upvotes: 1

Related Questions