我目前正在使用PHP在Google上編寫Actions上的集成。我用我的測試端點生成了一個action.json文件作爲履行。我使用ngrok公開公開本地開發機器。模擬器不斷回覆端點不能被調用,而我在日誌中看到POST請求
不幸的是,模擬器一直堅持應用程序沒有響應。在訪問日誌和ngrok Inspector中,我確實看到有一個請求進入,而且它已被JSON回覆整齊地回答。
在純粹絕望的行爲中,我甚至上傳了一個JSON響應,直接從Fulfillment documentation page獲取到服務器並將其設置爲履行URL。結果是相同的,相同的錯誤。
我沒有看到從Google上的操作獲取更詳細的錯誤消息的方法,解釋了爲什麼它不起作用。
我action.json:
{
"actions": [
{
"name": "MAIN",
"intent": {
"name": "actions.intent.MAIN"
},
"fulfillment": {
"conversationName": "development4"
}
},
{
"name": "TEXT",
"intent": {
"name": "actions.intent.TEXT"
},
"fulfillment": {
"conversationName": "development4"
}
}
],
"conversations": {
"development4": {
"name": "development4",
"url": "https:\/\/02c085c0.ngrok.io\/actionsongoogle\/process\/development4"
}
}
}
我的答覆:JSON:
{
"expectUserResponse": false,
"expectedInputs": [{
"inputPrompt": {
"richInitialPrompt": {
"items": [{
"simpleResponse": {
"textToSpeech": "hello"
}
}]
}
},
"possibleIntents": [{
"intent": ["actions.intent.TEXT"]
}]
}]
}
在模擬器輸出的結果然後顯示:
{
"response": "my test app isn’t responding right now. Try again soon.\n",
"audioResponse": "//NExAARq...",
"debugInfo": {
"sharedDebugInfo": [
{
"name": "ExecutionResponse",
"debugInfo": "Failed to call your endpoint."
}
]
},
"visualResponse": {}
}
我只注意到它使用的API版本爲V1,即使文檔狀態:'如果你創建了一個項目2017年5月17日或之後,您的助手應用默認會使用v2 API。「將''fulfillment_api_version「:2'屬性添加到我的對話中不幸沒有幫助。 – matueranet