guide

Relays

Make things happen without writing code: when a provider sends a webhook, on a schedule, or when a record changes, Gemmein can write a record, grant access, email the person or call your URL. A relay is one JSON file that tells Gemmein what to do.

Here is the GoCardless case: a payment confirms, the payer gets Pro, an email goes out, and your function hears about it.

{
  "name": "gocardless-paid",
  "trigger": {
    "kind": "receiver",
    "verify": { "scheme": "signature", "header": "Webhook-Signature" },
    "map": {
      "event_id": "events.0.id",
      "event_type": "events.0.action",
      "person_email": "events.0.details.customer_email"
    },
    "when": { "event_type": "confirmed" }
  },
  "actions": [
    { "type": "grant_access", "entitlement": "Pro", "reason": "GoCardless payment {{mapped.event_id}}" },
    { "type": "email_person", "subject": "Your payment is confirmed", "text": "Thanks. Pro is open on your account." },
    { "type": "call_url", "url": "https://hooks.example.com/paid" }
  ]
}

What it is. A rule you write as a file: when this happens, do these things. When the trigger fires, Gemmein runs the actions, stores the event, retries when something fails, and shows every run in the dashboard with a replay button. Stripe is built in. Any provider whose webhooks follow a signing standard Gemmein supports, such as GoCardless, Lemon Squeezy, Paddle or Shopify, grants access the same way through a relay; RevenueCat does too, through a shared token (see Unsigned events).

What it does. Thirteen actions, and only these: write a record, grant access, revoke access, grant credits, fulfil or refund a product, grant or revoke a plan, email the person the event is about, call your URL, start a run on a named AI tool for the event's person, charge the person who called the relay (spend_credits), and, once Functions is switched on for your account, run one function your AI wrote (run_function, naming it by function) — your own code, hosted on Cloudflare, that reads and writes only through the caller's own rights or a reach you approved by hand.

What it does not do. Call your URL and run_function are the only two that run anything of yours — every other action is a verb Gemmein itself carries out, never your code. Call your URL sends a signed notice to a server you run, with Gemmein's body and Gemmein's signature; you cannot shape that request, so it cannot call OpenAI or any API that wants your key and its own format. run_function runs your own code inside Gemmein once Functions is switched on for your account, and only with the reach you approved.

A schedule has no person attached, so "email everyone whose trial ends tomorrow" is not something a relay does. An action maps fields as they are and never reshapes data with custom logic. One event acts on one person; emailing a list is a broadcast, which a relay does not do. A relay that reacts to an event adds credits and never spends them. The one relay that spends is a relay your app calls (app_call), and it takes only the caller's own credits, before anything is written. Charging for work your server does happens on your server, or through an AI tool.

When you need something else. Anything that thinks (a model call, a score, a transform, a third API) runs in your own function behind call your URL, which receives a verified event with the person already resolved. An AI tool is where Gemmein holds your provider key and makes a chat call for a signed-in person. It costs the credits you set on the tool it names, or one credit for a call that names no tool.

In this section

Limits

  • 150 relays per environment.
  • 10 actions per relay.
  • 120 events per minute.
  • 32 KB stored per event. A larger body is truncated with a flag, and the mapped fields survive.
  • 256 KB per receiver body.

Limits are raised on request: hello@gemmein.com.

CodeStatusMeaning
invalid_definition400One sentence naming the field, why, and what to do
relay_capped400This environment holds 150 relays. Delete one, or fold two into one
duplicate_grant_target400Two grant or take actions act on the same target (a product, an access key, a plan, or credits). Merge them into one action
name_taken409A relay with this name exists in this environment
version_conflict409The definition changed since it was read. Re-read and reapply
not_replayable409Replay applies to a dead, failed or done event. A queued or running one is already on its way
Was this page helpful?

Last updated