Webhooks
LocallyGrown uses an inbound webhook from Mailgun to keep email state in sync. Card payments are made and recorded in the same request when a manager completes orders, so there is no Stripe webhook. This page describes the integration.
X-LocallyGrown-Signature header or public webhook
payload format. If outbound webhooks would be valuable for your market, let us know via
the support channels.Overview
LocallyGrown receives one inbound webhook, from Mailgun. It is handled server-side and is not configurable from the admin UI — the endpoint is wired up as part of the platform itself.
💳 Stripe: no webhook
Each market has its own Stripe account, and every charge is made synchronously when a manager completes orders: the order is marked paid and the payment recorded in that same request. Stripe never calls LocallyGrown back.
📧 Mailgun
Email delivery events — including unsubscribes, permanent bounces, and complaints —
arrive at /api/webhooks/mailgun and update user accounts and email analytics.
Mailgun webhook
Endpoint: POST /api/webhooks/mailgun
Signature verification: Mailgun's standard HMAC signature using the configured
signing key.
Events handled
unsubscribed— the recipient clicked the unsubscribe link in a market email. LocallyGrown treats this as a signal that the user wants to leave the market altogether and deactivates their account. (Users who just want to stop receiving email but stay in the market use the Subscribe/Unsubscribe button on their account page instead — see the Shopper Accounts guide.)failed(permanent severity) — a hard bounce; the address is flagged so we stop sending to it.complained— a spam complaint; the address is flagged.
All event types are also recorded as email-analytics rows for per-market delivery metrics. Events are batched in memory before being written, with a fallback queue for reliability if the database insert fails.
Operational notes
- No retry configuration inside LocallyGrown. Retry behavior is whatever Mailgun provides by default — we don't manage a retry queue for inbound webhooks.
- Health checks. If a webhook endpoint is misbehaving, the platform
health-check endpoints (
/api/health,/api/health/queues) are the right place to start looking. Webhooks themselves don't have a dedicated status page. - Configuration. Mailgun is configured platform-wide and is not exposed in the admin UI. Stripe setup is per-market — see the Stripe Integration guide — and needs no webhook endpoint registered in the Stripe dashboard.