Dialogflow Python 中的 Fulfillment Webhook
Fulfillment Webhook in Python for Dialogflow
我想在 Python 中使用 Flask 开发一个 webhook。我在网上找到的所有文档和教程都是针对 Node.js。
如何在 Webhook 中使用 Python 为某些意图添加建议信息块和操作卡?
如果您查看 Google 上的操作的 Responses doc,您会看到可以使用的 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。
我想在 Python 中使用 Flask 开发一个 webhook。我在网上找到的所有文档和教程都是针对 Node.js。
如何在 Webhook 中使用 Python 为某些意图添加建议信息块和操作卡?
如果您查看 Google 上的操作的 Responses doc,您会看到可以使用的 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。