2017-11-26 5 views
0

私はTwitterのチャットボットを作成しています。Twitter:クイック返信付きの直接メッセージがありませんボタン

私のfailed hackingの優れたTweetinviライブラリ(まだすばやい返信をサポートしていません)の後に、私は根に戻ろうとしましたが、問題を単純化するためにTwurlを使用しました。

私はマイナーな編集とsample provided by Twitterを試してみました:

  • は、ユーザーIDを変更。
  • でCR LFを置き換えるには、「

最後のメッセージは、私は迅速な返信ボタンなしでテキストのみを見ることができますが、を送られているものにを削除しました。ここで

は、Twitterの応答のMy 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"}]}}}}}' 

です:メッセージの形式はOKらしい

-> "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をインストールするには、私はこの問題は、不正な形式のJSONたthis excellent tutorial

+1

こんにちは、私はできるだけ早くそれを調べますが、私は現在の瞬間を使い果たしています。 – Linvi

答えて

0

を追いました。この

{"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}]}}}}} 

それが動作します。

関連する問題