The Twitter platform is using https://github.com/PLhery/node-twitter-api-v2
The Twitter api was being rebuild when Elon Musk bought it and broke it. Part of it now runs on OAuth1, and part of it on Oauth2, and you have to configure both. Hopefully, one day, the 'O1' keys will not be needed anymore.
- go to https://developer.twitter.com/
- create a few developer account
- you get a project and an app, rename those
- set up User authentication settings
- read and write
- fairpost is a bot
- redirect url with host/port from your .env (http://localhost:8000/callback)
- website https://github.com/commonpike/fairpost
- From the Oauth 01 settings
- generate Api Key and secret
- save these in your global .env as
FAIRPOST_TWITTER_OA1_API_KEYFAIRPOST_TWITTER_OA1_API_KEY_SECRET
- generate access token and secret, make sure it is read and write
- save these in your global .env as as
FAIRPOST_TWITTER_OA1_ACCESS_TOKENFAIRPOST_TWITTER_OA1_ACCESS_TOKEN_SECRET
- From the OAuth 2 settings
- save
FAIRPOST_TWITTER_CLIENT_IDin your global .env - save
FAIRPOST_TWITTER_CLIENT_SECRETin your global .env
- save
- Add 'twitter' to your
FEED_PLATFORMSin your usersstorage.json
This token should last forever (?)
- call
./fairpost.js @userid connect-platform --platform=twitter - follow instructions from the command line
- call
./fairpost.js @userid test-platform --platform=twitter
One fairpost user can only manage one feed. If you create a second user, you can use the same app to manage a different feed. OAuth2 allows you to enable the app for your second account, but the OAuth1 part is tied to your first account and requires you to specify an 'additional_owner' for the uploaded media.
- call
./fairpost.js create-user --userid=foo
- call
./fairpost.js @foo connect-platform --platform=twitter - follow instructions from the command line
- call
./fairpost.js @foo test-platform --platform=twitter
- from the previous
test-platformresult, copy theoauth2:id - set this as the
TWITTER_OA1_ADDITIONAL_OWNERin your users storage.json
TWITTER_PLUGIN_SETTINGS- a json object describing / overwriting the plugins used to prepare posts
https://github.com/twitterdev/twitter-api-typescript-sdk/blob/main/src/gen/Client.ts#L889