Receiving and Sending Webmentions
Incoming webmentions through webmention.io, rendered at build time in Astro, and outgoing ones sent by webmention.app after every deploy.
Reviewed by adrian
on
With MF2 markup in place, the next piece on my old site was notifications between sites. A webmention is a plain HTTP POST: when someone links to my post from their own site, they send one to my endpoint, and I can show it under the post. It works both ways. You send webmentions when you link to others and receive them when others link to you.
The setup
- Static Astro 6 site, deployed on every content update.
- webmention.io as the hosted receiving endpoint.
- webmention.app as the outgoing notifier, called by the deploy script.
- Goal: incoming mentions baked into the static HTML at build time, outgoing ones sent after each successful deploy.
Receiving with webmention.io
A receiver has to accept arbitrary POSTs, validate the source URLs, store mentions and expose them. I did not want to run that myself for a static site. webmention.io does all of it. After logging in, it gives you a link tag for the <head>:
<link
rel="webmention"
href="https://webmention.io/adrian-altner.de/webmention"
/>
Every page with this tag can receive webmentions, and webmention.io validates and stores them.
Logging in without a password
webmention.io uses IndieLogin, which authenticates by domain. It follows the rel=me links on the homepage (Joining the IndieWeb), picks one that points to an OAuth provider such as GitHub and sends you through that flow. So I logged in to IndieWeb services as adrian-altner.de, not with a username or an email address. A Bluesky domain handle works as a provider too, through the AT Protocol verification instead of rel=me HTML.
Showing mentions at build time
Fetching mentions at runtime would need either client-side JavaScript, with its CSP and privacy questions, or an edge function. Neither fitted. webmention.io has a REST API, so an Astro component fetched the mentions for each page URL during the build:
const WEBMENTION_IO = 'https://webmention.io/api/mentions.jf2';
const url = `${WEBMENTION_IO}?target=${encodeURIComponent(pageUrl)}&per-page=100`;
const res = await fetch(url);
const data = await res.json();
const mentions = data.children ?? [];
The component grouped them by type: likes (like-of), reposts (repost-of) and replies (in-reply-to, mention-of), each in its own section. With zero mentions it rendered nothing. An optional WEBMENTION_TOKEN environment variable made the requests authenticated. The token does not raise the page size (at most 1000 per request either way); it opens queries across the whole account and includes private webmentions. For mentions of a single public page the public API was enough.1
New mentions needed a redeploy to show up. For a site that deployed on every content update that was acceptable at first; Live webmentions on a static site fixed it later.
Sending with webmention.app
Receiving is passive. Sending needs action after each deploy: find the new outgoing links, discover their endpoints, send the POSTs. webmention.app reads an RSS feed and finds the outgoing links in recent posts. It checks whether the targets have a webmention endpoint and notifies them. Its token lived in .env.production.
The deploy script called it after each successful deploy, once per feed:
for feed in rss.xml rss/articles.xml rss/notes.xml rss/links.xml rss/photos.xml; do
curl -s -X POST \
"https://webmention.app/check?url=https://adrian-altner.de/${feed}&token=${TOKEN}"
done
Five feeds: articles, notes, links, photos and the combined one. Any outgoing link in a recent post got a webmention if the target supported it.
What stayed open
Most sites I linked to did not support webmentions. The mechanism cost nothing to run, though, and when a target did support them, the notification went out without extra work.
Takeaways
- Do not host your own receiver. webmention.io handles validation, storage and the API, and the integration is one
<link>tag. - The domain is the login. IndieLogin needs no password and no account, and the same identity works for Bridgy and other IndieWeb services.
- The send side is a shell loop around curl.
Based on
-
Webmentions: Receiving and Sending Cross-Site Reactions
(
raw/2026/2026-03-23/webmentions-receiving-and-sending-cross-site-reactions.md) [post] - webmention.io README [wmio]
Topic
- IndieWeb Publishing on your own domain first and connecting personal websites with open standards such as Webmention and Microformats.
Basis for
- Bluesky Reactions as Webmentions with Bridgy Bridgy polls Bluesky for likes, reposts and replies to syndicated posts and sends them back as webmentions, so they appear on the original post.
- Caching Webmention Avatars Locally An Astro helper that downloads webmention avatars during the build, dedupes and sweeps them, so the CSP stays strict and readers never hit the avatar host.
- Live Webmentions on a Static Site Webmentions rendered at build time plus a silent client-side refresh, so new likes and replies show up on a static Astro site without SSR or a redeploy.
Builds on
- Marking Up Posts with Microformats2 h-entry h-entry, h-card, h-feed and u-syndication classes on articles, notes and photos of an Astro site, machine-readable without any visible change.
Uses
- Astro Tool for building websites from content such as Markdown. Ships plain HTML by default and only loads JavaScript where it is needed.
Mentioned in
- Joining the IndieWeb Why I made my own domain the canonical home of everything I publish, and how rel=me and h-card verified my identity on the old site.