Prompt
Every Friday at 16:00, collect the issues closed this week from our Gitea repo, and draft a Mastodon weekly-roundup post: number of issues closed, the 2 most notable by title, and a thank-you line. Send it to the REST API with networks ["mastodon"] and an idempotencyKey of weekly-YYYY-WW. How to do it
- Mint a Mastodon agent key In https://app.socialhandoff.com, open Connections, connect your Mastodon account, then create an agent key scoped to Mastodon with draft permission only. Copy the key when it is shown; only its hash is stored.
- Pick a trigger Start the workflow with the event that should produce a post: an RSS item, a new row, a form submission, or a Schedule Trigger.
- Add an HTTP Request node Set it to POST https://app.socialhandoff.com/v1/posts with a Header Auth credential for the key. Send JSON with body, networks set to ["mastodon"], and mode "submit".
- Handle the response The response carries the post id and status. Branch on it to log the draft, or wait for the approval.requested and post.published outbound webhooks.
Example draft
Weekly roundup: 23 issues closed this week. Notable: sync no longer stalls on files over 2 GB, and the settings page finally remembers your sort order. Thanks to the 7 people who filed reports and the 3 who sent patches. You make this project better every week. #OpenSource #WeeklyRoundup
Gotchas
- Publishing uses idempotency keys, so a retried request after a timeout does not produce a duplicate toot.
- 500 characters is only the default. Many instances allow more or less, so set the per-network length guardrail to your server's real limit.
- Store the key in an n8n Header Auth credential, not typed into the node, so it does not leak when you export or share the workflow.
- Character limit: 500 characters on a default Mastodon server. Each instance can raise it, so check yours.
- Links: Every URL counts as 23 characters, however long it is.
- Media per post: Up to 4 attachments on a default server.
- File sizes: Images up to 16 MB and video up to about 99 MB on a default install. Instances can set their own limits.
Frequently asked questions
Should n8n use the REST API or MCP?
Use REST. The HTTP Request node maps cleanly to POST /v1/posts, and the OpenAPI spec at /openapi.json documents every field.
Will a retried n8n run post the same toot twice?
Not if you send an idempotencyKey. A second request with the same key returns the existing post instead of creating a new one.
Can I post to several fediverse accounts at once?
Yes. Connect each Mastodon account, and a single draft can target several. Each target is published and retried on its own.