Mastodon is an open source, decentralised social media platform. Similar to other social media platforms, once you create an account you can create posts, communicate with other users, follow their feeds, and so on. You can read up on it further for more information.

Mastodon has a simple API that allows you to write code that accesses Mastodon actions in various ways. An API (application programming interface) is a way for two computer programs to "talk" to each other. Put simply, you can write a CircuitPython program that interacts with Mastodon to do things like send a post, or read all posts under a certain hashtag, and much more!

This guide is an introduction to the Mastodon API. It does not refer to the ActivityPub API.

The first thing you need is your Mastodon API access token, which is necessary to communicate with the Mastodon API. The next page covers how to get your token. Then, there are two CircuitPython examples: posting to Mastodon, and tracking all messages using a particular hashtag on Mastodon. All of this using your Raspberry Pi Pico W!

Prerequisites

This guide assumes that you have a Mastodon account. If you do not, you can visit the Mastodon site to sign up. If you would like more information before doing so, check out the Mastodon documentation.

Hardware

For this guide, you'll need the following.

Angled shot of a green microcontroller with castellated pads.
The Raspberry Pi foundation changed single-board computing when they released the Raspberry Pi computer, now they're ready to...
Out of Stock
USB cable - USB A to Micro-B - 3 foot long
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or...
$2.95
In Stock

This guide was first published on Dec 06, 2022. It was last updated on Mar 01, 2024.

This page (Overview) was last updated on Nov 29, 2022.

Text editor powered by tinymce.