更新:您的 webhook 响应需要包含以下形式的 JSON 对象以请求权限:
{
"speech": "...", // ASCII characters only
"displayText": "...",
"data": {
"google": {
"expect_user_response": true,
"is_ssml": true,
"permissions_request": {
"opt_context": "...",
"permissions": [
"NAME",
"DEVICE_COARSE_LOCATION",
"DEVICE_PRECISE_LOCATION"
]
}
}
},
"contextOut": [...],
}
当前可用的唯一权限是 NAME、DEVICE_PRECISE_LOCATION 和 DEVICE_COARSE_LOCATION。这记录在这里:https ://developers.google.com/actions/reference/webhook-format#response
上一个答案:
您可以在开发人员参考中找到 JSON 布局(在下面复制),但Node.js 客户端库使这变得容易得多,而且看起来您可以在 Lambda 上安装 npm 模块。
{
"user": {
"user_id": "...",
"profile": {
"given_name": "John",
"family_name": "Doe",
"display_name": "John Doe"
},
"access_token": "..."
},
"device": {
"location": {
"coordinates": {
"latitude": 123.456,
"longitude": -123.456
},
"formatted_address": "1234 Random Road, Anytown, CA 12345, United States",
"city": "Anytown",
"zip_code": "12345"
}
},
"conversation": {
"conversation_id": "...",
"type": "ACTIVE",
"conversation_token": "..."
},
"inputs": [
{
"intent": "assistant.intent.action.MAIN",
"raw_inputs": [
{
"query": "..."
}
],
"arguments": [
{
"name": "destination",
"raw_text": "SFO",
"location_value": {
"latlng": {
"latitude": 37.620565,
"longitude": -122.384964
},
"formatted_address": "1000 Broadway, San Francisco, CA 95133"
}
}
]
}
]
}