LoginSignup
0

More than 3 years have passed since last update.

TwitterのDMのグループ会話にPOSTする方法

Last updated at Posted at 2019-04-30

教えてください

これまでできてること

・Twitter APIを通じて個人宛にDMを送ること
・TweetDeckの該当のリクエストの中身をみて、該当のapiを正規のaccess_tokenとかで叩くとforbiddenであることを確認すること※

公式ドキュメントに乗っているDMのエンドポイント

request_body
event: {
  type: "message_create",
  message_create: {
    target: { recipient_id: 1111111 },
    message_data: { text: text }
  }
}

追記 recipient_idにおそらくグループ会話ごとに設定されているconversation_idなるものを設定してもforbiddenになった
recipient_idの代わりにconversation_idとして、"11111-22222"みたいな、相手と自分のidを付与すると普通に送れた
なぜgroup会話はだめなんだーーーーーー

forbiddenになったTweetDeckのエンドポイント※

https://api.twitter.com/1.1/dm/new.json
こちらは公式ドキュメント上に存在しないapiであった(私が確認する限り)

request_body
{
  text: "test",
  ext: "altText",
  conversation_id: 1111111,
  cards_platform: "Web-13",
  include_entities: 1,
  include_user_entities: 1,
  include_cards: 1,
  send_error_codes: 1,
  tweet_mode: extended,
  include_ext_alt_text: true,
  include_reply_count: true
}

m(_ _)m

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0