PR

X(旧Twitter)のAPIキー取得方法

スポンサーリンク

はじめに

本記事では、X(旧Twitter)のBot作成や自動ツイートなどを行うために必要な、APIキーの取得方法について解説します。

今回はFreeアカウントを対象としています。

Twitter API キーとは?

Twitter API キーとは、TwitterのAPIにアクセスするために必要な認証情報です。

これには、 以下の4つの要素が含まれています。

  • API Key
  • API Secret Key
  • Access Token
  • Access Token Secret

これらのキーとトークンは、Twitterのデータにプログラムでアクセスする際に、アプリケーションがX(旧Twitter)に対して自身を識別するために使用されます。

APIキー作成方法

X Developer Portalにログイン

まず、X Developer Portalにログインします。

アクセス後は右上の[Developer Portal]をクリックします。

Sign up for Free Accountをクリック

ログイン後の画面では画面一番下の[Sign up for Free Account]をクリックします。

Developer agreement&policyを入力

Developer agreement&policyでは、XのデータやAPIを利用したユースケースを記述する必要があります。

こちら最低文字数が設けられているので、的確に入力しないといけません。
以下をコピペで問題ありませんので、ご活用ください。

I plan to harness the Twitter API to develop an automated bot for my Twitter account. This bot’s primary role is to schedule and post valuable content for other users at specific times each day. Utilizing the extensive data on Twitter and the power of the Twitter API, the bot will curate and share insightful information or updates tailored to the interests and needs of my followers. This automation will ensure consistent interaction with my audience while greatly improving the efficiency of my daily tasks. By automating this part of my social media strategy, I can devote more time to other essential activities while sustaining a strong online presence. Through this initiative, I aim to balance delivering value to my followers with optimizing my workflow.

他3箇所のチェックボックスにチェックを入れた後、[Submit]をクリックします。

自動でTwitter Developer Portalのダッシュボード画面に移動します。

以前は新規でアプリを作成する必要がありましたが、仕様の変更によりデフォルトでアプリが作成されるため、アプリの作成は必要ありません。

APIキーの発行

APIキーの発行のため、画面下部の[PROJECT APP]内の歯車マークをクリックします。

[Settings]タブより、[User authentication settings]の[Set up]をクリックします。
※筆者の場合、設定済みなので、「Edit」にってますので注意が必要です。

以下は基本的な設定の例となります。入力後[Save]をクリックすると完了です。

その後、[Client ID][Client Secret]が発行されます。この内容はコピーして控えておき、[Done]をクリックして完了となります。

お疲れ様でした。

コメント

タイトルとURLをコピーしました