A lightweight program to crosspost from Mastodon to Twitter, suitable for self-hosting. It will poll the Mastodon instance every minute for new posts and post them to Twitter.
WARNING This is a work in progress with only basic functionality for cross-posting tweets and your own replies.
- A Mastodon account
- A Twitter account
- A Twitter developer account with OAuth 1.0 and 2.0 credentials
Twitter API v1.1 is required for posting media, and v2.0 is required for posting tweets.
go install github.com/mcartmell/mastodon-twitter-crosspost@latest
Create a .env
file with your credentials, for example:
MASTODON_URL=https://mastodon.example.com
MASTODON_ACCOUNT_ID=123456789
TWITTER_OAUTH2_REDIRECT_URI=http://localhost:8888
TWITTER_OAUTH2_CLIENT_ID=123456789
TWITTER_OAUTH2_CLIENT_SECRET=123456789
TWITTER_CONSUMER_KEY="123456789"
TWITTER_CONSUMER_SECRET="123456789"
TWITTER_ACCESS_TOKEN="123456789"
TWITTER_ACCESS_TOKEN_SECRET="123456789"
LISTEN_PORT=8888
Run the program:
mastodon-twitter-crosspost
The program will output a link to authorize API access to your Twitter account. Follow the instructions to complete the authorization.
- Crossposts from Mastodon to Twitter
- Supports crossposting own threads
- Supports images
This is a work in progress with many missing features:
- Support for videos
- Support for content warnings
There is a Dockerfile included for deployment, intended for self-hosting with minimal memory usage.
This project is licensed under the MIT license, see the LICENSE file for details.