我正在学习如何制作Messenger机器人。我有代码侦听生命的意义,然后给出2个快速响应的 42和巧克力,其中42的有效载荷是真实的,巧克力的有效载荷是假的检查回发我检查该有效载荷,它不起作用。我了解我丢失了某些内容,因为该按钮不能用作回发操作,因此我如何使它在该按钮上执行某些操作。代码在这里: gomix/#!/project/fb -messenger-bot
I am learning how to make messenger bots. I have code to listen for 'what is the meaning of life' and then give 2 quick response's '42' and 'chocolate' the payload for 42 is 'the real one' the payload for chocolate is 'the fake one' in where I check postbacks I check for that payload, it does not work. I understand that I am missing something because the button does not operate as a postback so how do I make it do something on that button. The code is here: gomix/#!/project/fb-messenger-bot
在聊天机器人中,发送泛型会通过网站和两个按钮向您发送消息,是生命的意义,它有2个快速反应其他任何事情都会在您身上回荡。
In the chatbot sending 'generic' sends a message back to you with a website and two buttons when you say what is the meaning of life it has the 2 quick responses anything else is echoed at you.
推荐答案点按回复按钮,将不会触发回发。而是将以与回发不同的响应格式接收回叫。该事件将具有一个消息属性,该属性与您的快速回复按钮类型相似,带有一个quick_reply键,其中包含该按钮的有效载荷。
When a quick reply button is tapped, it will not trigger a postback. Instead a callback will be received with a different response format than that of postback. The event will have a message attribute which will be similar to your quick reply button type with a quick_reply key which contains the payload of the button.
{ "sender": { "id": "USER_ID" }, "recipient": { "id": "PAGE_ID" }, "timestamp": 1464990849275, "message": { "mid": "mid.1464990849238:b9a22a2bcb1de31773", "seq": 69, "text": "Red", "quick_reply": { "payload": "DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_RED" } } }因此,您可以使用
event.message.quick_reply.payload更多推荐
Messenger的快速响应不会触发postbak
发布评论