Twitter:带有快速回复的直接消息缺少按钮

Twitter: direct message with quick reply is missing buttons

我正在构建一个 Twitter 聊天机器人,我需要直接消息上的快速回复按钮。

经过我的failed hacking on the excellent Tweetinvi library (does not support the quick reply yet) I tried to go back to the roots and used Twurl简化问题。

我尝试使用 sample provided by Twitter 进行少量编辑:

消息终于发送了但是我只能看到文字,没有快速回复按钮。

这是我的 twurl 命令行

twurl authorize (the 4 tokens)
twurl account

(账号已授权)

twurl -t -A 'Content-type: application/json' /1.1/direct_messages/events/new.json -d '{"event":{"type":"message_create","message_create":{"target":{"recipient_id":"999999999"},"message_data":{"text":"What syourfavoritetypeofbird?","quick_reply":{"type":"options","options":[{"label":"RedBird","description":"Adescriptionabouttheredbird.","metadata":"external_id_1"},{"label":"BlueBird","description":"Adescriptionaboutthebluebird.","metadata":"external_id_2"},{"label":"BlackBird","description":"Adescriptionabouttheblackbird.","metadata":"external_id_3"},{"label":"WhiteBird","description":"Adescriptionaboutthewhitebird.","metadata":"external_id_4"}]}}}}}'

这是 Twitter 回复:

-> "status: 200 OK\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write-directmessages\r\n"
-> "x-connection-hash: b85f0c59aeb2f9b8b4c439fb448e541a\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-response-time: 225\r\n"
-> "x-transaction: 006a0b630064b6c7\r\n"
-> "x-tsa-request-body-time: 0\r\n"
-> "x-twitter-response-tags: BouncerCompliant\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"

消息格式似乎没问题(我在文本中使用'时出现错误)但是我没有看到按钮,所以我寻求建议。

注意:要在 Windows 上安装 twurl,我遵循了 this excellent tutorial

问题格式不正确 Json。

有了这个

{"event": {"type": "message_create","message_create": {"target": {"recipient_id": "12345"},"sender_id": "6789","message_data": {"text": "Choose your destiny","quick_reply": {"type": "options","options": [{"label": "one","metadata": "1","description": "One descr"},{"label": "Two","metadata": "2","description": "Descr 2}]}}}}}

有效。