Gactions project is sending version 1 request schema

*爱你&永不变心* 提交于 2020-01-07 04:20:53

问题


According to this document Actions on Google - Overview

Google is now using version 2 JSON schema, but the requests my server is receiving from the simulator is version 1. Is there something I need to do to get version 2 JSON schema?

I have updated my gactions project action.json file to the new format and uploaded it.

This is my action.json

{
"actions": [
    {
        "description": "Default Welcome Intent",
        "name": "MAIN",
        "fulfillment": {
            "conversationName": "welcome"
        },
        "intent": {
            "name": "actions.intent.MAIN"
        }
    },
    {
        "description": "Example response",
        "name": "Raw input",
        "fulfillment": {
            "conversationName": "rawInput"
        },
        "intent": {
            "name": "raw.input",
            "parameters": [
                {
                    "name": "requestText",
                    "type": "SchemaOrg_Text"
                }
            ],
            "trigger": {
                "queryPatterns": [
                    "$SchemaOrg_Text:requestText"
                ]
            }
        }
    }
],
"conversations": {
    "welcome": {
        "name": "welcome",
        "url": "https://myserver.com/api/request/gactions",
        "fulfillmentApiVersion": 2
    },
    "rawInput": {
        "name": "rawInput",
        "url": "https://myserver.com/api/request/gactions",
        "fulfillmentApiVersion": 2
    }
}

}


回答1:


The simulator now sends version 2 and my application has not been approved yet. Here is what I get:

Request headers:
host: gactions.example.com
accept-encoding: gzip,deflate,br
content-type: application/json
google-actions-api-version: 2
user-agent: Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)
content-length: 380
x-forwarded-port: 443
x-forwarded-proto: https
x-forwarded-host: example.com
x-forwarded-server: ip-10-0-0-36.ec2.internal
connection: Keep-Alive
--------
Body of request: 
{
    "user": {
        "userId": "1500679128193",
        "locale": "en-US"
    },
    "conversation": {
        "conversationId": "1500679128193",
        "type": "NEW"
    },
    "inputs": [{
            "intent": "actions.intent.MAIN",
            "rawInputs": [{
                    "inputType": "KEYBOARD",
                    "query": "talk to tom's applicaiton"
                }
            ]
        }
    ],
    "surface": {
        "capabilities": [{
                "name": "actions.capability.AUDIO_OUTPUT"
            }, {
                "name": "actions.capability.SCREEN_OUTPUT"
            }
        ]
    },
    "device": {},
    "isInSandbox": true
}


来源:https://stackoverflow.com/questions/44308005/gactions-project-is-sending-version-1-request-schema

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