Twitter started out like many exciting tech projects. It invented and then offered a unique "microblogging" service, a kind of interactive RSS feed. Twitter as a company was open to fresh ideas and offered a lot of features. It gradually became such a big deal in modern web usage that it, presumably, felt the need to reel it all back in. Today, Twitter clearly can't support all the crazy things people want to do with it, and has gotten rid of a lot of the features they once offered, and are frequently criticized for being simultaneously unmoderated and too restrictive.
Because it's such a part of the modern web, people tend to treat Twitter as something "we" own. There's certainly a case to be made that the users of even a closed system ultimately do own it, at least insofar as losing all users would essentially end the service. Yet the fact remains that Twitter is a closed source communication method on the otherwise open HTTP medium.
Can open source solve this technical and social quandary?
GNU Social and Mastodon
GNU Social is a social communication software for both public and private communications. It's a microblogging platform in which any person or group of people can run their own nodes of communication, and also connect these nodes to one another for intercommunication. It solves the ownership problem in both the literal and emotional sense: the code, being open source (AGPL), is owned by everyone, and the nodes themselves are so numerous that users can shop around to find a community that best suits them, or start a personal node.
Each node, being independently run and managed, can be used as a private node, or it can be open to other users, it can block users or feeds, or it can accept feeds. Control is truly placed in the hands of the users, and yet the end result is a truly social network.
Mastodon is one implementation of GNU Social focusing on a good, clean user interface and a low barrier-to-entry for self-hosting.
And it's spreading like wildfire as the premier Twitter alternative.
The best thing about it is that you can tether Mastodon and Twitter together to ease your transition.
Joining Mastodon
Part of the advantage of Mastodon is that there isn't just one Mastodon. The project itself owns and runs mastodon.social, but that's just one node in a much larger network. You can join any Mastodon instance that is accepting new users. There's a list of running instances on instances.mastodon.xyz.
On the other hand, if you like to tinker on servers, you're also free to just run your own instance. Mastodon is open source, so (unsurprisingly) developers have contributed several ways to set it up. You can run it as a software package on your server, or run it as a Docker image, or even, experimentally, as a Heroku service.
Signing up with an existing instance is easy. Provide a working email address for account verification and set your desired password. Once you have verified your email address, log in as you would to any other website, using your email address as your login name and your password. Once logged in, you can also set up two-factor authentication.
Using Mastodon
The default Mastodon web interface is a little more complex than Twitter, but no more than, for instance, TweetDeck. There are, of course, other interfaces you could use with Mastodon, including mobile apps or custom Atom feeds or custom web apps using Mastodon's rich API. Since everyone starts out with the web UI, however, it's a good thing to look at to get used to Mastodon's capabilities.
Screenshot of the Mastodon web interface. CC-0.
The web UI consists of four columns. The left column is your primary control panel. Most importantly, it contains your username and avatar, and a text field for you to enter you text. In Mastodon, anything you post is called a "toot" (as in a car horn, or, possibly, the sound that prehistoric mastodons made?).
The left column also has several tabs at the top: Get Started, Local Timeline, Federated Timeline, Preferences, and Logout. That's pretty much all you need to know in order to navigate the interface. Here's what each tab does:
Get Started
The Get Started view is your current, default view. It returns all the other columns to their default views. Think of this as your Home Button.
Local Timeline
The Local Timeline contains all posts by any non-blocked and non-muted user on the same Mastodon server. This is different from Twitter because with Twitter there is no local instance. With Mastodon, you can form communities of users on just one node.
Federated Timeline
The Federated Timeline is a feed of all public posts happening on all nodes. This is the most Twitter-like view of Mastodon's activity because it breaks down the concept of nodes and displays everything happening on the worldwide network.
Preferences
Users have several options for interacting with other Mastodon users, and those settings in the Preferences panel.
Mastodon preferences. CC-0.
You can set your posts to be private or to go only to your followers. You can also configure two-factor authentication, edit your profile, change your password, add "apps" so that you can interact with Mastodon through its API, configure email notifications, and more.
Feeding frenzy
That's a lot to take in, but the easiest way to start is to just click on the Federated Timeline tab and watch all the excited Mastodon users toot their random thoughts at you in the fourth column.
Federated feed. CC-0.
Interacting with other users is intuitive. You can reply to their post, you can re-post a post that you like, you can follow a user so that their posts appear in your personal feed, located in the second column.
The third column contains notifications. When other users interact with you, you'll see that in the third column.
To sum up:
- Column 1 is your command center.
- Column 2 is your personal feed.
- Column 3 contains notifications.
- Column 4 displays either your local or the federated timeline.
That's Mastodon.
Mastodon to Twitter with Python3
A social network depends equally on both the "social" part and the "network" part. Mastodon has healthy representation of both.
The technology is stable and robust, so it networks very well, and it's had major boosts in users ever since it scored some high-profile media coverage. However, chances are that not everyone you know on Twitter has migrated yet to Mastodon, so you may want to have your posts on Mastodon also appear on your Twitter feed. You don't want to have to do that manually.
You can get Mastodon and Twitter to cross-post with a tool called MastodonToTwitter. It's a Python 3 script that interacts with Twitter and Mastodon through their respective APIs. On the Twitter side, it takes a little bit of setup, since allowing Twitter API interaction on your account is opt-in.
First, you need to join dev.twitter.com to get a consumer key and access token, each of which permits you to use external scripts to control Twitter.
Once you create an account at dev.twitter.com, navigate to My Apps and click the Create New App button.
Create new app. CC-0.
Creating a new app isn't nearly as scary as it sounds. In this context, the "app" really is just a mechanism to acquire login tokens. Name your app anything you want to, provide a fake description and a fake website. Leave the callback field empty.
You can use these settings, verbatim. CC-0.
Once your app has been created, you're taken to an overview of the app. While this does provide your consumer key, you need several more pieces to enable API access. Click the manage keys and access tokens link next to the Consumer key (API Key) line.
App overview. CC-0.
On the Application Settings screen, click the Create my access token button. This generates your access tokens, and displays all the information you need in one place.
Keep it secret, keep it safe. CC-0.
Keep these keys safe, because they allow access to your account without information like username and password. Do not share them with others, do not take screenshots of them and post them online.
Running MastodonToTwitter.py
To run MastodonToTwitter, you must install its dependencies: pip3, python-twitter, and Mastodon.py. To obtain these these on Fedora or similar Linux distribution:
$ sudo dnf install python3-pip
$ sudo python3 -m pip install twitter-python Mastodon.py
Then download MastodonToTwitter from GitHub.
$ git clone https://github.com/halcy/MastodonToTwitter.git MastodonToTwitter.clone
Change directory to MastodonToTwitter.clone and run the script with Python3:
$ python3 ./MastodonToTwitter.py
The script has a first-run setup mode that automatically launches if it doesn't find configuration files, so just follow the prompts.
For Twitter, there will be four prompts: one for each key that you obtained from creating your Twitter app. Just paste in the key codes, exactly as Twitter provided them.
For Mastodon, you'll only need your registered email address and password.
Once you've passed all the setup steps, MastodonToTwitter runs non-interactively, silently listening to Twitter and Mastodon for any activity. Post something to Mastodon, and you'll see it be detected by MastodonToTwitter, and then in about 30 seconds the same post pops up as a Twitter post. The same works in reverse.
How you run MastodonToTwitter is up to you. You're free to run in manually whenever you want to cross-post, or you can set it up as a cron job so that it runs every hour or two. If you're a very active Twitter user, you can even run it as a daemon on a server (a low-powered Raspberry Pi server is pretty easy to set up) so that it syncs your accounts instantly.
Join the federation
The future of the independent and free web is in the federation: independent nodes managed by real people with real and trusted communities, all feeding into a larger amalgamation. The GNU project, MediaGoblin, Mastodon, GNUnet, and many others, are working toward making this a reality.
Instead of complaining about being abused by your Internet corporate sponsors, why not join the Federation? Captain Kirk did, and things turned out pretty well for him. Give Mastodon a try!
9 Comments