2017-11-26 19 views
0

Twitter 채트 봇을 만들고 있는데 직접 메시지에 빠른 답장 버튼이 필요합니다.Twitter : 빠른 답글을 작성한 직접적인 메시지가 누락되었습니다.

우수한 Tweetinvi 라이브러리 (아직 빠른 답장을 지원하지 않음)에서 failed hacking을 본 후 나는 뿌리로 돌아가려고하고 Twurl을 사용하여 문제를 단순화했습니다.

나는 약간의 편집과 sample provided by Twitter으로 시도 :

  • 변경된 사용자 ID;
  • 이 (가) '마지막

를 무슨 메시지가 하지만를 전송에 내가 빠른 응답 버튼없이 텍스트 만 볼 수 있습니다 제거 아무것도

  • 와 CR의 LF를 교체했다. 여기

    트위터 응답의 내 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"}]}}}}}' 
    

    입니다 :

    -> "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" 
    

    메시지 형식이 확인 보인다 (I 오류가있어 '텍스트'를 사용했을 때) 버튼을 볼 수 없으므로 조언을 구합니다.

    참고 : Windows에서 twurl를 설치하는 나는 this excellent tutorial

  • +1

    안녕하세요, 가능한 한 빨리 살펴 보겠습니다. 현재 시간이 부족합니다. – Linvi

    답변

    0

    문제는 잘못된 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}]}}}}} 
    

    .