mastodon
Installation
SKILL.md
Call the Mastodon REST API with curl + jq. Two connector credentials are
injected: $MASTODON_BASE_URL (the instance, e.g. https://mastodon.social)
and $MASTODON_ACCESS_TOKEN. Every request sends the header
Authorization: Bearer $MASTODON_ACCESS_TOKEN.
Errors come back as JSON {"error":"<message>"} — show it verbatim. 401
("The access token is invalid") means the token is wrong/revoked → the user
must re-connect the Mastodon connector. Posting needs the token to have the
write (or write:statuses) scope.
Always confirm the token + account first (also gives the account id you
need to list your own toots):
curl -sS "$MASTODON_BASE_URL/api/v1/accounts/verify_credentials" \
-H "Authorization: Bearer $MASTODON_ACCESS_TOKEN" \
| jq '{id, username, acct, display_name, followers: .followers_count, statuses: .statuses_count}'