本日の目標DMMと楽天こぼで無料の漫画をツイートするサイト(アプリ?)を作る!
— elve (@elve_hatena) 2022年8月11日
というわけでTwitterAPI V2とやらを触ってみるよ。
JSON body parameters
POST /2/tweets | Docs | Twitter Developer Platform
の自分用メモ。今回はtextだけ有ればいい。
Name | Type | Description |
direct_message_deep_link | string | Tweets a link directly to a Direct Message conversation with an account. アカウントとのダイレクト メッセージの会話へのリンクを直接ツイートします。なにそれ怖い Example: {"text": "Tweeting a DM deep link!", "direct_message_deep_link": "https://twitter.com/messages/compose?recipient_id=2244994945"} |
for_super_followers_only | boolean | Allows you to Tweet exclusively for Super Followers. スーパー フォロワー専用のツイートを許可します。だれ?それ。(なんか投げ銭的な?) Example: {"text": "Hello World!", "for_super_followers_only": true} |
geo | object | A JSON object that contains location information for a Tweet. You can only add a location to Tweets if you have geo enabled in your profile settings. If you don't have geo enabled, you can still add a location parameter in your request body, but it won't get attached to your Tweet プロフィールで位置情報を有効にしてる時ツイートに場所を追加できます |
geo.place_id | string | Place ID being attached to the Tweet for geo location. 場所ID Example: {"text": "Tweeting with geo!","geo": {"place_id": "5a110d312052166f"}} |
media | object | A JSON object that contains media information being attached to created Tweet. This is mutually exclusive from Quote Tweet ID and Poll. メディア情報 |
media.media_ids | array | A list of Media IDs being attached to the Tweet. This is only required if the request includes the tagged_user_ids. メディア情報ID Example: {"text": "Tweeting with media!", "media": {"media_ids": ["1455952740635586573"]}} |
media.tagged_user_ids | array | A list of User IDs being tagged in the Tweet with Media. If the user you're tagging doesn't have photo-tagging enabled, their names won't show up in the list of tagged users even though the Tweet is successfully created. タグ付けされたユーザーID Example: {"text": "Tagging users in images!", "media": {"media_ids": ["1455952740635586573"], "tagged_user_ids": ["2244994945","6253282"]}} |
poll | object | A JSON object that contains options for a Tweet with a poll. This is mutually exclusive from Media and Quote Tweet ID. 投票 |
poll.duration_minutes | number | Duration of the poll in minutes for a Tweet with a poll. This is only required if the request includes poll.options. 投票時間 Example: {"text": "Tweeting with polls!", "poll": {"options": ["yes", "maybe", "no"], "duration_minutes": 120}} |
poll.options | array | A list of poll options for a Tweet with a poll. For the request to be successful it must also include duration_minutes too. 投票の時必要っぽい感じ Example: {"text": "Tweeting with polls!", "poll": {"options": ["yes", "maybe", "no"], "duration_minutes": 120}}" |
quote_tweet_id | string | Link to the Tweet being quoted. 引用するツイートのID Example: {"text": "Yay!", "quote_tweet_id": "1455953449422516226"} |
reply | object | A JSON object that contains information of the Tweet being replied to. リプライする時 |
reply.exclude_reply_user_ids | array | A list of User IDs to be excluded from the reply Tweet thus removing a user from a thread. リプライするユーザーID Example: {"text": "Yay!", "reply": {"in_reply_to_tweet_id": "1455953449422516226", "exclude_reply_user_ids": ["6253282"]}} |
reply.in_reply_to_tweet_id | string | Tweet ID of the Tweet being replied to. Please note that in_reply_to_tweet_id needs to be in the request if exclude_reply_user_ids is present. 返信ツイートID。リプライするなら必須 Example: {"text": "Excited!", "reply": {"in_reply_to_tweet_id": "1455953449422516226"}} |
reply_settings | string | Settings to indicate who can reply to the Tweet. Options include "mentionedUsers" and "following". If the field isn’t specified, it will default to everyone. リプライ権限みたいなやつ。クソ Example:{"text": "Tweeting with reply settings!", "reply_settings": "mentionedUsers"} |
text | string | Text of the Tweet being created. This field is required if media.media_ids is not present. ツイート内容。メディアが無いなら必須よ。 Example: {"text": "Hello World!"} |