[Dialogflow]Update Permission through Webhook format (for push notifications)

∥☆過路亽.° 提交于 2019-12-10 23:54:59

问题


ORIGINAL REQUEST: I'm trying to implement the push notifications following the documentation: https://developers.google.com/actions/assistant/updates/notifications

I'm using Dialogflow with webhooks (in PHP) and the documentation is giving example in nodeJS

Right now, i'm blocked because of the Update permission, here's my Webhook response :

{
"source": "webhook",
"payload": {
    "google": {
        "expectUserResponse": true,
        "systemIntent": {
            "intent": "actions.intent.PERMISSION",
            "data": {
                "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
                "permissions": [
                    "UPDATE"
                ]
            },
            "updatePermission": {
                "intent": "notification.simple.text"
            }
        }
    }
}
}

When I do the simulation, asks me a permission for a push, but not for the intent I specified.

I'm quiet sure that the problem is the updatePermission, something must be wrong with that: Is it the field name? In intent, i put the intent name that i filled in dialogflow, maybe do i have to an use action? Is it in the good format ?

If someone can help me or just give me an example of a clean response for an update permission.

Thanks!

Solution

I just found why, my json wasn't good, the updatePermissionValueSpec must be into data object.

{
"source": "webhook",
"payload": {
    "google": {
        "expectUserResponse": true,
        "systemIntent": {
            "intent": "actions.intent.PERMISSION",
            "data": {
                "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
                "permissions": [
                    "UPDATE"
                ],
                "updatePermissionValueSpec": {
                    "intent": "notification_simple_text"
                }
            }
        }
    }
}
}

回答1:


I believe updatePermission should be named updatePermissionValueSpec.

Example response:

"payload": {
  "google": {
    "expectUserResponse": true,
    "richResponse": {
      "items": [
        {
          "simpleResponse": {
            "textToSpeech": "PLACEHOLDER"
          }
        }
      ]
    },
    "systemIntent": {
      "intent": "actions.intent.PERMISSION",
      "data": {
        "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
        "permissions": [
          "UPDATE"
        ],
        "updatePermissionValueSpec": {
          "intent": "intent_name"
        }
      }
    }
  }
}


来源:https://stackoverflow.com/questions/50725790/dialogflowupdate-permission-through-webhook-format-for-push-notifications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!