0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

外部からTwitterのDM画面を立ち上げるURLを生成する

Last updated at Posted at 2021-07-29

※2021/07/29 時点では挙動を確認済ですが、Twitterがいつ仕様変更するかは不明瞭なのでお気をつけください

- 利用されてないAPI等を切る傾向あり
- 昔はpublish.twitter.comの公式側でサポートあったが今はない…

TL;DR

  • 外部サイトとかから
  • Twitterに連絡をもらいたいときに
  • DMを立ち上げるURLを生成する方法

ユースケース:
スクリーンショット 2021-07-29 23.48.59.png

前提

  • DMを開放して受け取れる設定にする

設定方法

  • もっと見る > 設定とプライバシー > プライバシーとセキュリティ > ダイレクトメッセージ > 「すべてのアカウントからのメッセージリクエストを許可する」にチェック
Step1 Step2
スクリーンショット 2021-07-29 23.35.20.png スクリーンショット 2021-07-29 23.36.22.png

URLを準備する

完成形

https://twitter.com/messages/compose?recipient_id={user_id}

の形でURLを用意する

例:https://twitter.com/messages/compose?recipient_id=786590689651896320

user_id を把握するには

こちらのTWITTER ID CONVERTERから確認が可能

  • 検索窓にHN(@hogehoge)を入力して
    • @はつけてもつけなくもOK
  • 返ってきた文字列がuser_id
※他人のIDも把握できるのですが、言わずもがな悪用は厳禁です
※以前はTwitterのサービス上から確認ができたのですが、どうやらできなくなってしまったようです(もしくは表示場所が変わってしまった)

利用したい箇所で利用する

  • ブログ
  • HP
  • 求人記事
  • Webサービス/App

などなど

0
0
0

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?