用于在Google

时间:2018-06-13 13:44:58

标签: python node.js actions-on-google

针对Google上的操作的Node.js包是here

使用此功能,它可以很好地获取应用和对话形式谷歌应用程序。

用于在Google上执行操作的Python的类似库是什么?

1 个答案:

答案 0 :(得分:2)

Google目前没有官方执行库。可能有一个由社区成员维护。

如果您想使用Python,您也可以使用JSON消息进行响应。 documentation for Actions on Google有一个标签,描述了您需要发送的直接JSON响应。

这样,Node.js代码

conv.ask(new SimpleResponse({
  speech: 'Howdy! I can tell you fun facts about almost any number, like 42. What do you have in mind?',
  text: 'Howdy! I can tell you fun facts about almost any number, like 42. What do you have in mind?',
}));

相当于

{
  "conversationToken": "",
  "expectUserResponse": true,
  "expectedInputs": [
    {
        "inputPrompt": {
            "richInitialPrompt": {
                "items": [
                    {
                        "simpleResponse": {
                            "textToSpeech": "Howdy! I can tell you fun facts about almost any number, like 42. What do you have in mind?",
                            "displayText": "Howdy! I can tell you fun facts about almost any number. What do you have in mind?"
                        }
                    }
                ],
                "suggestions": []
            }
        },
        "possibleIntents": [
            {
                "intent": "actions.intent.TEXT"
            }
        ]
    }
]}