Examples

Every example on these pages is a real file in the examples/ directory of the repository, included here verbatim. Clone the repo and run any of them directly.

They are licensed under CC0 and so are fully dedicated to the public domain, so use them as the base for your own bots without worrying about copyright.

Tip

Replace 'my-handle' and 'my-password' before running anything. Use an app password, not your account password. See Authentication.

Basics

Post, reply, embed images and video, read a timeline, like, repost, and follow.

Basics
Advanced usage

Sessions, pagination, rich text, link cards, direct messages, proxies, and error handling.

Advanced usage
Firehose

Subscribe to the whole network’s repository and label events, and decode the commits.

Firehose
Jetstream

The same stream as plain JSON, filtered server-side, plus archive backfill.

Jetstream

Two more live elsewhere because they need their surrounding prose: