我有一个样本电报机器人,我已经集成在我的api.ai帐户。我想像下面这样显示键盘按钮,但api.ai似乎只向电报发送主要文本回复。你知道我如何才能实现我刚才描述的内容吗?请提供指导和/或解决方案。谢谢!

我有一个实现的webhook url,它在调用我的示例意图时返回这个json。
{
"id": "af681b42-9ced-4f8f-ab0c-0559b210dc1a",
"timestamp": "2016-07-15T01:47:30.896Z",
"result": {
"source": "agent",
"resolvedQuery": "Hello",
"action": "show-main",
"actionIncomplete": false,
"parameters": {},
"contexts": [],
"metadata": {
"intentId": "e477976e-2412-4066-b320-48d7dedd5dfe",
"webhookUsed": "true",
"intentName": "Adobo"
},
"fulfillment": {
"speech": "Hello world!",
"source": "index.php",
"data": {
"chat_id": 1,
"text": "hi there",
"parse_mode": "HTML",
"reply_markup": {
"keyboard": [
"A1",
"A2"
],
"one_time_keyboard": true,
"resize_keyboard": true
}
}
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "4cb02864-9925-4d4c-a0f1-14dbab44add7"
}我已经在"data“下面添加了回复标记键盘的json格式。
发布于 2016-07-15 15:05:33
你以前可以单独发送文本(没有键盘)吗?
我认为这是一个语法错误。"keyboard"字段应该是由数组组成的数组。请尝试使用以下代码片段替换该字段。
"reply_markup": {
"keyboard": [
["Day", "Week", "Month"],
["Users", "Retention"],
["sessions", "Events"],
["Back"]
],
"one_time_keyboard": true,
"resize_keyboard": true
}https://stackoverflow.com/questions/38376354
复制相似问题