簡體   English   中英

用於 Dialogflow 的 Python 中的 Fulfillment Webhook

[英]Fulfillment Webhook in Python for Dialogflow

我想使用 Flask 在 Python 中開發一個 webhook。 我在網上找到的所有文檔和教程都是針對 Node.js 的。

如何在 webhook 中使用 Python 為某些意圖包含建議芯片和行動卡?

如果您查看 Actions on Google 的響應文檔,您會看到可以使用的 JSON 響應,而不是 Node.js。

帶有建議芯片的響應具有以下格式:

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "These are suggestion chips."
            }
          },
          {
            "simpleResponse": {
              "textToSpeech": "Which type of response would you like to see next?"
            }
          }
        ],
        "suggestions": [
          {
            "title": "Suggestion 1"
          },
          {
            "title": "Suggestion 2"
          },
          {
            "title": "Suggestion 3"
          }
        ],
        "linkOutSuggestion": {
          "destinationName": "Suggestion Link",
          "url": "https://assistant.google.com/"
        }
      }
    }
  }
}

或者,您可以從第三方開發人員那里找到一個預先存在的庫來提供實現,例如flask-dialogflow

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM