Mastodon header

Let’s say some narcissistic moron buys the social media company you use daily and decides that it would be better off with 100x the Nazis. You decide this isn’t for you, so you find yourself exploring the world of Mastodon. Mastodon is cool, but its federated nature means that people are spread out across a bunch of different instances. These instances have different names, so user handles are all over the place. That being the case, let’s have a little fun by creating our own custom Mastodon handle.

What you’ll be getting

I joined a Ruby community on Mastodon, so my handle is @[email protected]. But I can pass around @[email protected] and still have people discover me. I.e. pasting @[email protected] into Mastodon’s search will return me:

Mastodon search results

It’s not very hard to set up, so let’s get to it.

Setting everything up

I will assume you have your own website with your own domain name. You will need to be able to return a json response when /.well-known/webfinger is requested. E.g. How you respond to a request at that path will largely depend on your stack. In Rails we’d define this in routes.rb:

# Mastodon verification
get "/.well-known/webfinger", to: "static_pages#mastodon", defaults: {format: "json"}

Getting your JSON

The contents of your JSON file can be found at https://<your mastodon server>/.well-known/webfinger?resource=acct:<your account>@<your mastodon server>. Copy and paste the contents found there into a file you will serve from your own website. Once you publish your changes, you can conjure up any clever handle you want. It just has to follow the following format:

All done

Now you can pass out your customized handle and feel super duper cool about it. Pretty easy!

Written by Matt Haliski

The First of His Name, Consumer of Tacos, Operator of Computers, Mower of Grass, Father of the Unsleeper, King of Bad Function Names, Feeder of AI Overlords.