Messenger的快速响应不会触发postbak

编程入门 行业动态 更新时间:2024-10-27 11:18:43
本文介绍了Messenger的快速响应不会触发postbak的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在学习如何制作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

本文发布于:2023-11-26 04:40:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632660.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:快速   Messenger   postbak

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!