amazon

Twitter API 有料で止まったかと思った

はじめに

Twitter API 有料化の話[1]がでていて、あおしちゃんBOTが出なくなったのでついに停止されたのか。。。と思っていたらそうではなかった話

あおしちゃんBOT

営業日の翌日に前日の ETF の値下がりをつぶやく BOT を作って運用していました。

あおしちゃん BOT のつぶやき例
図1 あおしちゃん BOT のつぶやき例

ついにエラーに

1週間ほど前からつぶやかないようになったんで「ついに有料化で止まったか・・・」と思っていました。話が二転三転してよくわからなくなったので放置していたのですよね

デバックで原因確認

久しぶりに時間ができたのでデバックしたらエラーが

+"client_id": "xxx"
  +"detail": "When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal."
  +"registration_url": "https://developer.twitter.com/en/docs/projects/overview"
  +"title": "Client Forbidden"
  +"required_enrollment": "Appropriate Level of API Access"
  +"reason": "client-not-enrolled"
  +"type": "https://api.twitter.com/2/problems/client-forbidden"
}

よくよく読むと アプリがプロダクトに紐づいていないと

解決法

Twitter developer サイトでプロダクトを見ると確かにアプリがないので紐づけると今までのキーでつぶやき復活しました

参考

[1] Twitter APIの有償化は再延期。「数週間で段階的に提供」, https://www.watch.impress.co.jp/docs/news/1479765.html

コメント

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