Facebook Send API提到您可以为通用响应模板上的按钮设置的“有效负载”类型。但是,他们没有说明它是如何工作的,除了:
For postback buttons, this data will be sent back to you via webhook
但是它是如何发送回来的呢?单击有效负载按钮时,我没有收到任何消息。有人成功使用过吗?
最佳答案
我测试了它,它对我有用。按钮的有效负载就像 html 按钮上的值。这意味着它对用户不可见,但它是发送回给您的值。
如果您创建这样的按钮:
'attachment': {
'type': 'template',
'payload': {
'template_type': 'button',
'text': 'This is the description',
'buttons': [
{
'type': 'postback',
'title': 'This is the visible text',
'payload': 'This is the value you get back'
}
]
}
包含有效载荷的回调看起来像这样:
{'timestamp': 1461697120850, 'postback': {'payload': 'this is the value you get back'}, 'recipient': {'id': xxxxxxxx}, 'sender': {'id': xxxxxxxx}}
关于facebook - Facebook 机器人按钮上的 "Payload"选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36851079/