# Support for federated events in Yonder


<div class="yonder-embed" data-status="117677491892523975"><a href="https://manganiello.tech/statuses/117677491892523975/embed">Post by @fabio</a></div>
<script async src="https://manganiello.tech/embed.js" charset="utf-8"></script>
<noscript><iframe src="https://manganiello.tech/statuses/117677491892523975/embed" width="100%" height="400" frameborder="0" loading="lazy" title="Post by @fabio"></iframe></noscript>

The post above is a real event, authored from Yonder's composer and rendered from the embedded status.

This article is about how it got there — and how it travels to other ActivityPub servers.

And by the way, if you are using an account on a federated network that supports [`FEP-8a8e` events](https://w3id.org/fep/8a8e), feel free to RSVP to it, so I also have a better sense of how many people use the Fediverse from implementations that support this feature 🙂

## The problem: events in a microblogging world

Events are the piece of the social graph that the fediverse has historically handled worst. Mastodon doesn't understand them at all: `Event` is on the list of ["converted" types](https://github.com/mastodon/mastodon/blob/main/app/lib/activitypub/activity.rb) in its ActivityPub code, and its [status parser](https://github.com/mastodon/mastodon/blob/main/app/lib/activitypub/parser/status_parser.rb) replaces the text of a converted object with `name` + `summary` + a link. `content` is discarded outright, and every structured field — start time, place, join mode, attendee list — with it.

[Mobilizon](https://mobilizon.org/) was built specifically to fill that gap, and it does it well, but it's a separate platform: separate accounts, separate timelines, separate moderation, and a hard seam between "my microblogging life" and "my event life".

[FEP-8a8e](https://w3id.org/fep/8a8e) ("FEP for Events") is the draft specification that tries to close that seam: it defines how `Event` objects, locations, RSVP activities and attendee collections should be represented and exchanged over [ActivityPub](https://activitypub.rocks/), so that any compliant server can author, federate and respond to events without needing a separate account on a dedicated platform.

[Yonder](https://yonder.social) now implements it. The work landed in the [`feat/events`](https://git.platypush.tech/blacklight/yonder/pulls/16) branch, merged after a fair number of interoperability bugs that only a real multiple-instance deployment could surface.

This article walks through what was built, the design decisions behind it, and the parts of the problem that turned out to be harder than they looked.

## Events are statuses

The foundational decision shapes everything else: **an event is a status**, not a separate entity.

A Yonder event is a `statuses` row with `object_type = 'Event'` — the title lives in the status title, the description in the normal content fields — plus an `events` side table and child tables for locations, organizers and participations.

This mirrors how [Yonder](https://blog.fabiomanganiello.com/article/Yonder) already handles polls and articles, and it buys a lot for free: replies, boosts, favourites, bookmarks, reports, timelines, search, pins and the entire moderation surface keep working on events without a single line of extra code. An event can be public, unlisted, followers-only, local-only or invitees-only, and the existing visibility machinery applies unchanged.

The FEP-8a8e metadata lives in side tables providing:

- `startTime`/`endTime` with a real IANA timezone
- Event status (`scheduled`, `cancelled`, `postponed`, `rescheduled`, `moved_online`)
- Physical `Place` locations with structured address parts or coordinates
- `VirtualLocation`s for online events (hybrid events can have both)
- Categories, join mode, capacity, banner and flyer.

On the wire, the outbound object is a full FEP-8a8e `Event`:

- `name`
- `startTime`/`endTime` in the event's own timezone
- `location` as an array of `Place`/`VirtualLocation`
- `category`
- `joinMode`
- `eventStatus` with its iCal companions
- `previousStartTime` on reschedules
- The banner as `image`
- `Link` attachments carrying the permalink and the per-event ICS feed — so even a client that can't render events natively still gets copy-link and download-calendar affordances.

One subtlety worth calling out: the JSON-LD context. The FEP's own context URL (`https://w3id.org/fep/8a8e`) redirects to Codeberg Pages and serves `text/plain`, which strict JSON-LD loaders — Friendica among them — may choke on. Yonder therefore inlines the term definitions (`fep8a8e:`, `sc:` for schema.org, `mz:`, `ical:`) into the AP context's object member, and is careful to never redefine plain ActivityStreams terms like `location`, `Place`, `startTime`, `endTime` or `name`, which some remote implementations resolve against their own vocabulary.

## Degrading gracefully to Mastodon

Mastodon is the elephant in the room: it has no event support, no `Join` activity, and a peculiar rendering rule for non-`Note` objects — it *discards* `content` entirely and renders `<h2>name</h2>` + `summary` + a link instead (see the [status parser](https://github.com/mastodon/mastodon/blob/main/app/lib/activitypub/parser/status_parser.rb) quoted above).

[Gancio](https://gancio.org/), [Mobilizon](https://mobilizon.org/) and the [WordPress Event Bridge](https://codeberg.org/Event-Federation/wordpress-event-bridge-for-activitypub) all emit a machine-generated `summary` for exactly this reason — Gancio's [federation docs](https://gancio.org/dev/federation) are explicit that it exists "for Mastodon" — and Yonder does the same: the `summary` is a "When: … / Where: … / Online: …" preamble plus a description excerpt, so a Mastodon user sees a useful post rather than a bare title.

That degradation path produced two of the most instructive bugs of the whole epic, both only visible in live federation:

- **The summary is not a content warning.** Mastodon never folds `summary` into `spoiler_text` — but [Akkoma does](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/activity_pub/object_validators/event_validator.ex): it accepts `Event` as a note-like object with no event semantics, and its Mastodon-API view renders `summary` as a content warning. Yonder's own ingest code had the same blind spot — the guard that was supposed to exclude events from the summary-as-CW fold only covered the Mastodon "converted" types (`Article`, `Page`, `Audio`, `Video`), never `Event`. The result: every remote event rendered on a Yonder instance collapsed behind an unreadable content warning containing a concatenation of when, where, title and description. A corrective migration cleared the damage on already-ingested rows.
- **The excerpt must be HTML, not markdown.** Since Mastodon renders the summary *in place of* the content, the description excerpt inside the summary is what Mastodon users actually read. Injecting the raw markdown source there meant `[label](https://example.com)` displayed literally. The excerpt is now taken from the status's rendered, sanitized HTML and truncated HTML-aware — entities count as one visible character, `<img>` tags are dropped as preview noise, and truncation closes any still-open tags after the ellipsis.

The same preamble is reused at read time in Yonder's Mastodon-compatible API, so third-party apps (Tusky, Ivory, Phanpy…) that know nothing about events still render a readable post — with one exception: event-aware clients like pl-fe get the structured `yonder.event` block instead, so they don't render the preamble twice.

And since "Where: Massachusetts Institute of Technology" is much more useful as a link, the preamble's place lines are hyperlinks to OpenStreetMap or Google Maps (configurable per instance), mirroring what the Yonder UI does: coordinates win — an OSM pin or a `lat,lon` Maps query — with the structured address parts as a search-query fallback.

## RSVP: one state machine, two dialects

RSVP is where FEP-8a8e gets interesting, because the fediverse doesn't have one RSVP protocol — it has at least two, and they're not compatible:

- The **Mobilizon-style join dialect**: a `Join` activity targeting the event, answered by the organizer with `Accept`/`Reject`/`Ignore`, undone with `Leave`. Mobilizon's [federation documentation](https://docs.mobilizon.org/5.%20Interoperability/1.activity_pub/) spells out exactly this table — `Join` applies to `Event`, `Accept`/`Reject` apply to `Join`, and `Leave` to `Event` — and notably its `Invite` activity only applies to `Group` membership, not to events. (Nicolex, [mkljczk's Pleroma fork](https://codeberg.org/mkljczk/nicolex) and the closest analogue to Yonder's approach, follows the same join dialect but sends `Undo{Join}` to leave, so both spellings have to be accepted.)
- The **Friendica/Hubzilla invite dialect**: the organizer sends an `Invite{object: event, to: [invitee]}`, and the invitee answers with `Accept`/`TentativeAccept`/`Reject` on the *invite*. In Friendica's ActivityPub code, [`Receiver.php`](https://github.com/friendica/friendica/blob/develop/src/Protocol/ActivityPub/Receiver.php) maps those three activities on an `Event` to attend / don't-attend / maybe, and [`Transmitter.php`](https://github.com/friendica/friendica/blob/develop/src/Protocol/ActivityPub/Transmitter.php) is where the outbound event and its addressing are built; there is no `Join` at all. Hubzilla uses the same `Invite` model — that's recorded in the [FEP-8a8e history section](https://codeberg.org/fediverse/fep/src/branch/main/fep/8a8e/fep-8a8e.md) rather than in any Hubzilla documentation I could find.

Yonder implements both, inbound and outbound, on top of a single state machine. The local RSVP API ([`POST /api/v1/yonder/events/{id}/rsvp`](https://manganiello.tech/swagger-ui/#/events/event_rsvp)) and the inbound ActivityPub activities drive the same machine, so there's exactly one source of truth for what `pending`, `accepted`, `tentative`, `declined`, `rejected` and `ignored` mean, how capacity is enforced under row locks, and how replays stay idempotent. Join modes map onto the dialects: `free` joins are instant, `restricted` events queue a participation request for the organizer's approval, `invite` events are gated on `Invite` activities or invitations, and `external` events simply redirect to an `externalParticipationUrl`.

The dialect selection is per-remote-event, informed by a cached nodeinfo lookup: answering an invitation on a Mobilizon-style event sends `Join`, answering on a Friendica-style event sends `Accept` on the stored invite activity.

Invitations themselves come in two flavours too. The Friendica/Hubzilla `Invite{Event}` path is organizer-authorized and writes an `invited` participation row.

And there's the [Catodon](https://codeberg.org/catodon/catodon) mechanism, which is refreshingly primitive: invite people by **direct message**. A `direct` Note mentioning the invitees carries a `yonder:inviteTo`/`catodon:inviteTo` extension property with the event URI; inbound, any `Create` carrying either property writes `invited` rows for its local mentions — no organizer check, because anyone who can see an event may invite.

If the event hasn't federated to the receiving instance yet, the invite parks in a pending table and drains when the `Event` object materializes. It's fire-and-forget: no visibility change, no participation row, and the RSVP still follows the event's own protocol. The design is Catodon's own — their [events federation notes](https://why.catodon.rocks/docs/events-federation/) describe the `catodon:inviteTo` direct-message invitation and the "answer in the dialect the event's server speaks" rule that Yonder's per-event dialect selection mirrors, and the implementation lives in their [EventInvitationService](https://codefloe.com/catodon/catodon/src/branch/main/packages/backend/src/core/EventInvitationService.ts).

## Beyond the card: calendar, discovery, notifications

An event you can't find later is barely an event, so the feature ships with the surrounding machinery:

- **Calendar export.** Every event has an ICS feed; profiles expose an anonymous public-events feed; and there's a personalized, token-gated subscription (`/users/{u}/calendar/{token}.ics`) that includes everything you organize or participate in — across visibilities — with your own RSVP encoded as `ATTENDEE;PARTSTAT`. It works as an "add by URL" subscription in Google Calendar, Nextcloud, Outlook and Apple Calendar. The token is the authorization: only its SHA-256 hash is stored, the plaintext URL is shown once, and revocation is immediate.
- **Discovery.** A chronological events API with category, hashtag, online, and near-me (bounding-box prefilter + great-circle distance) filters, backed by a personal `/events` page and a public `/events/discover` page. Discovery only ever surfaces events with `Public` in `to` — the calendar subscription is the one deliberate exception.
- **Actor `upcomingEvents`.** Actor documents advertise an OrderedCollection of the account's nearest upcoming events (public/unlisted, capped at 200), cached and invalidated on event create/edit/delete — the same pattern as `featured`.
- **Notifications and reminders.** Four `pleroma:*` notification types (`participation_request`, `participation_accepted`, `event_update`, `event_reminder`) that pl-fe already knows how to render, plus the standard Mastodon `update` notification for participants. A cron-configurable reminder sweep notifies accepted/tentative participants before the start time, idempotent via a `reminded_at` stamp that reschedules clear. Participants viewing a stale remote event trigger a bounded background re-fetch, so a reschedule on the origin instance propagates without anyone manually refreshing.

The composer gets a full event builder — title, times with timezone, locations with optional address autocomplete (Nominatim or Google, opt-in per instance), categories with icons, join mode, invitees, banner and flyer — and editing follows the same rules as any status: an edit with an event payload re-syncs the side tables, so cancel, postpone and reschedule are ordinary `Update` activities, never `Delete`s.

## The honest part: what's still unverified

FEP-8a8e is a draft, and the Fediverse is not a test suite. The implementation is covered by unit tests, fixture-driven parser tests (real payloads captured from live Mobilizon, Gancio, WordPress Event Bridge and Nicolex instances during research) and containerized e2e tests — including the two-instance RSVP round trip. But the live interop matrix against Mastodon, Mobilizon, Gancio, Friendica, Akkoma and the rest is only now being filled in on a deployed instance, and I expect a few more of the "works in fixtures, breaks in production" variety before the rows are all green. Mobilizon in particular [is known to reject](https://framagit.org/framasoft/mobilizon/-/issues/1669) payloads it doesn't fully understand, so the exact shape of Yonder's outbound documents matters as much as their semantics.

Two known rough edges, documented rather than hidden: `previousStartTime` is emitted as `xsd:dateTime` while the FEP's example context types it as `@vocab` (Yonder follows the FEP text; the upstream context is expected to be corrected), and calendar `ATTENDEE`/`ORGANIZER` values use `https://` actor URIs rather than `mailto:` cal-addresses, which RFC 5545 clients generally accept but don't all handle identically.

Non-goals for the initial release, in line with the FEP: recurrence and multi-date events, all-day events, embedded map tiles, tickets and payments, and anonymous participation.

## Try it

The feature is merged into Yonder `main` ([`e46b808`](https://git.platypush.tech/blacklight/yonder/commit/e46b80849b824fdda8ef74199081ac8c081efcde)). If you run an instance, events are gated behind an `[events]` config section — enable it, and the composer grows an event button, the app menu grows an Events page, and your actor document grows an `upcomingEvents` collection. If you run Mobilizon, Gancio, Friendica or anything else that speaks events: follow a Yonder account, and the events should start showing up in your timelines — structured, RSVP-able, and without a content warning in sight.
