DocumentationEmbed the customer portal

Embed the customer portal

Give each of your customers a branded webhook portal inside your SaaS app: mint a single-use portal session on your server (Node.js, Go, Python or curl), embed it in an iframe or redirect to it, and configure branding and allowed origins.

The customer portal lets each of your customers manage its own webhook endpoints and debug its own deliveries, without you building a settings page. Your server asks Webhook Relay for a single-use portal link for the signed-in customer (an outbound consumer). Your app shows that link in an iframe or redirects to it. The portal carries your name, logo and colours, and it acts only on that one customer's endpoints and messages. It is included on every plan, Free included.

Customer portal branded as Lumen Billing showing Acme Corp's endpoint with Send test event, Edit, Pause and Delete buttons, signing secret controls and a list of delivered invoice events
The portal as your customer sees it: their endpoint, its signing secret, a test button and every delivery.

What your customers can do

In the portalmanage session (default)read session
See endpoints, their state and failure rate✓✓
Browse your event catalog with example payloads✓✓
Read deliveries, attempts and responses for each message✓✓
Add, edit, pause, resume and delete endpoints✓
Choose event types, channels and a payload filter per endpoint✓
Deliver to an HTTPS URL, or to their own AWS SQS, SNS, S3, Google Pub/Sub or Cloud Storage✓
Reveal and rotate the signing secret, or import an existing one✓
Send a test event, retry a delivery, recover failures, replay skipped messages✓

A customer can't attach your Functions or do anything your own API would refuse: portal changes go through the same validation and plan limits. Every portal change is recorded in your account's audit log with the source portal, the consumer and who created the link. Writes are rate-limited per consumer. Test sends and recoveries are limited more tightly, because they use your account's daily test-event allowance and its recovery slots.

How it works

  1. Your server mints a link. When a signed-in user opens your "Webhooks" settings page, your backend calls POST /v1/outbound/consumers/{id}/portal-sessions with your Webhook Relay credentials and gets back a url.
  2. The browser opens it. Your page puts the url in an iframe (or redirects to it). The link carries a one-time token in its #fragment, so the token never reaches a server log or a Referer header.
  3. The portal exchanges the token. The portal page swaps the one-time token for a session that only works on the /v1/portal API and only for that consumer. A used or expired link can't be opened again, so mint a fresh one on every page load.

Your Webhook Relay credentials never reach the browser. Only the single-use link does.

Configure the portal

Open Outbound webhooks → Portal in the dashboard and set:

SettingWhat it does
NameShown in the portal header, for example your product name.
Logo URLAn https image shown next to the name.
Accent colour#RRGGBB used for buttons, links and the active tab.
ThemeFollow the visitor's system setting (auto, the default), or force light or dark.
Sites allowed to embed the portalThe https origins that may show the portal in an iframe, one per line, for example https://app.example.com or https://*.example.com (up to 20). Leave it empty if you only redirect.
Refresh URLAn https page in your app that mints a new link. An expired session shows a button that opens it.
Portal tab in the Webhook Relay dashboard with name Lumen Billing, accent colour #7c3aed, theme Follow the visitor, allowed origin https://app.lumen.example, a refresh URL, and an Embed it section with a curl and iframe snippet
Outbound webhooks → Portal: branding, allowed origins and the refresh URL. The Embed it section repeats the two snippets you need.

Settings belong to the account and apply to every environment. From code, PUT /v1/outbound/portal-settings replaces all of them, so send every field you want to keep:

curl --user "$RELAY_KEY:$RELAY_SECRET" \
  -H 'Content-Type: application/json' \
  -X PUT https://my.webhookrelay.com/v1/outbound/portal-settings \
  -d '{
    "name": "Lumen Billing",
    "logo_url": "https://app.lumen.example/logo.svg",
    "accent_color": "#7c3aed",
    "theme": "auto",
    "allowed_origins": ["https://app.lumen.example", "https://*.lumen.example"],
    "refresh_url": "https://app.lumen.example/settings/webhooks"
  }'

GET /v1/outbound/portal-settings returns them, together with your portal_id. The portal ID is public: it picks the branding and framing policy and grants no access. An origin that isn't https is refused with 400. For local development, open the portal as its own page (see Redirect instead of embedding), or put your dev server behind an https tunnel and allow that origin.

Create a portal session on your server

Mint a link each time a signed-in user opens the page. Use the consumer ID you registered for that user's organization. The examples authenticate with an access token restricted to Outbound: manage (RELAY_KEY and RELAY_SECRET). A restricted token can only reach outbound routes, so a leak exposes less.

// portal.ts — Node.js 18+ (built-in fetch)
const RELAY_API = "https://my.webhookrelay.com/v1/outbound";
const RELAY_AUTH =
  "Basic " + Buffer.from(`${process.env.RELAY_KEY}:${process.env.RELAY_SECRET}`).toString("base64");

type PortalLink = { url: string; expires_at: string; token_expires_at: string };

// Mint a single-use portal link for one of your customers (an outbound consumer).
export async function createPortalSession(
  consumerId: string,
  options: { capabilities?: "manage" | "read"; ttl?: number; next?: string; session_id?: string } = {},
): Promise<PortalLink> {
  const res = await fetch(`${RELAY_API}/consumers/${encodeURIComponent(consumerId)}/portal-sessions`, {
    method: "POST",
    headers: { Authorization: RELAY_AUTH, "Content-Type": "application/json" },
    body: JSON.stringify(options),
  });
  if (!res.ok) throw new Error(`portal session failed: ${res.status} ${await res.text()}`);
  return (await res.json()) as PortalLink;
}

// End a customer's open portal sessions (all of them, or one session_id), e.g. on sign-out.
export async function endPortalSessions(consumerId: string, sessionId?: string): Promise<number> {
  const res = await fetch(`${RELAY_API}/consumers/${encodeURIComponent(consumerId)}/portal-sessions/expire`, {
    method: "POST",
    headers: { Authorization: RELAY_AUTH, "Content-Type": "application/json" },
    body: JSON.stringify(sessionId ? { session_id: sessionId } : {}),
  });
  if (!res.ok) throw new Error(`end portal sessions failed: ${res.status} ${await res.text()}`);
  return ((await res.json()) as { ended: number }).ended;
}
// portal.go
package portal

import (
    "bytes"
    "context"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "net/url"
    "os"
    "time"
)

const relayAPI = "https://my.webhookrelay.com/v1/outbound"

type PortalSessionOptions struct {
    Capabilities string `json:"capabilities,omitempty"` // "manage" (default) or "read"
    TTL          int    `json:"ttl,omitempty"`          // seconds, 3600-604800; 0 = 12 hours
    Next         string `json:"next,omitempty"`         // e.g. "endpoints/new"
    SessionID    string `json:"session_id,omitempty"`   // your tag, to end it later
}

type PortalLink struct {
    URL            string    `json:"url"`
    ExpiresAt      time.Time `json:"expires_at"`
    TokenExpiresAt time.Time `json:"token_expires_at"`
}

func relayPost(ctx context.Context, path string, body, out any) error {
    payload, err := json.Marshal(body)
    if err != nil {
        return err
    }
    req, err := http.NewRequestWithContext(ctx, http.MethodPost, relayAPI+path, bytes.NewReader(payload))
    if err != nil {
        return err
    }
    req.SetBasicAuth(os.Getenv("RELAY_KEY"), os.Getenv("RELAY_SECRET"))
    req.Header.Set("Content-Type", "application/json")
    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        return err
    }
    defer resp.Body.Close()
    if resp.StatusCode >= 300 {
        msg, _ := io.ReadAll(io.LimitReader(resp.Body, 4096))
        return fmt.Errorf("webhook relay %s: %s %s", path, resp.Status, msg)
    }
    return json.NewDecoder(resp.Body).Decode(out)
}

// CreatePortalSession mints a single-use portal link for one consumer.
func CreatePortalSession(ctx context.Context, consumerID string, opts PortalSessionOptions) (*PortalLink, error) {
    var link PortalLink
    err := relayPost(ctx, "/consumers/"+url.PathEscape(consumerID)+"/portal-sessions", opts, &link)
    return &link, err
}

// EndPortalSessions ends a consumer's open sessions; an empty sessionID ends all of them.
func EndPortalSessions(ctx context.Context, consumerID, sessionID string) (int64, error) {
    var out struct {
        Ended int64 `json:"ended"`
    }
    body := map[string]string{}
    if sessionID != "" {
        body["session_id"] = sessionID
    }
    err := relayPost(ctx, "/consumers/"+url.PathEscape(consumerID)+"/portal-sessions/expire", body, &out)
    return out.Ended, err
}
# portal.py — pip install requests
import os
from urllib.parse import quote

import requests

RELAY_API = "https://my.webhookrelay.com/v1/outbound"
RELAY_AUTH = (os.environ["RELAY_KEY"], os.environ["RELAY_SECRET"])


def create_portal_session(consumer_id: str, **options) -> dict:
    """Mint a single-use portal link. options: capabilities, ttl, next, session_id."""
    resp = requests.post(
        f"{RELAY_API}/consumers/{quote(consumer_id, safe='')}/portal-sessions",
        json=options,
        auth=RELAY_AUTH,
        timeout=10,
    )
    resp.raise_for_status()
    return resp.json()  # {"url": ..., "expires_at": ..., "token_expires_at": ...}


def end_portal_sessions(consumer_id: str, session_id: str | None = None) -> int:
    resp = requests.post(
        f"{RELAY_API}/consumers/{quote(consumer_id, safe='')}/portal-sessions/expire",
        json={"session_id": session_id} if session_id else {},
        auth=RELAY_AUTH,
        timeout=10,
    )
    resp.raise_for_status()
    return resp.json()["ended"]
curl --user "$RELAY_KEY:$RELAY_SECRET" \
  -H 'Content-Type: application/json' \
  -X POST https://my.webhookrelay.com/v1/outbound/consumers/acme_corp/portal-sessions \
  -d '{"capabilities": "manage", "session_id": "user-123"}'

The response is 201 Created:

{
  "url": "https://my.webhookrelay.com/portal/8e003056-845f-492b-8701-6cd9c9108611#token=wrpt_…",
  "expires_at": "2026-11-26T18:11:00Z",
  "token_expires_at": "2026-11-26T06:26:00Z"
}

token_expires_at is the deadline for opening the link (15 minutes). expires_at is when the session ends once it's open. Treat url like a password until it's used: return it only to the signed-in user, never log it, and don't cache the response.

OptionDefaultNotes
capabilitiesmanagemanage lets the customer change endpoints, send tests and recover deliveries; read only browses. Pick per user role.
ttl43200 (12 hours)Session lifetime in seconds after the link is opened, from 3600 (1 hour) to 604800 (7 days). Out of range is 400.
nextendpointsThe page to open: endpoints, endpoints/new, endpoints/<id>, event-types or messages/<id>. Useful for deep links such as "Add your first endpoint".
session_idnoneYour own tag, up to 128 characters, such as user-123. Use it to end that user's sessions later.
ResponseMeaning
201The link was created.
400An invalid option, such as ttl out of range.
401 / 403Missing or wrong credentials, or a token without outbound access, or bound to another environment.
404No consumer with that ID in this environment, or an unknown environment.

SDK support

The TypeScript and Go SDKs add portal helpers in their next releases: relay.outbound.portalSessions.create() / .expire() and a React <WebhookRelayPortal url={url} /> component in @webhookrelay/sdk, and CreateOutboundPortalSession / ExpireOutboundPortalSessions in webhookrelay-go. Until those versions are published, call the REST endpoint as shown above. It's the same request.

Embed it in your app

Expose a small authenticated route that mints a link for the signed-in user. Your settings page calls it and puts the URL in an iframe. Use POST so that browsers, link previews and prefetchers never trigger it, because each link works only once.

// Express 5. requireUser is your own auth middleware.
import express from "express";
import { createPortalSession } from "./portal";

const app = express();

app.post("/api/webhooks/portal", requireUser, async (req, res) => {
  const user = req.user;
  const { url } = await createPortalSession(user.organizationId, {
    capabilities: user.isAdmin ? "manage" : "read",
    session_id: `user-${user.id}`,
  });
  res.set("Cache-Control", "no-store").json({ url });
});
// Register with: mux.Handle("POST /api/webhooks/portal", requireUser(portalHandler))
func portalHandler(w http.ResponseWriter, r *http.Request) {
    user := currentUser(r) // your own auth
    caps := "read"
    if user.IsAdmin {
        caps = "manage"
    }
    link, err := CreatePortalSession(r.Context(), user.OrganizationID, PortalSessionOptions{
        Capabilities: caps,
        SessionID:    "user-" + user.ID,
    })
    if err != nil {
        http.Error(w, "could not open the webhooks portal", http.StatusBadGateway)
        return
    }
    w.Header().Set("Cache-Control", "no-store")
    w.Header().Set("Content-Type", "application/json")
    json.NewEncoder(w).Encode(map[string]string{"url": link.URL})
}
# Flask. login_required and current_user come from your auth (e.g. Flask-Login).
from flask import Flask, jsonify

from portal import create_portal_session

app = Flask(__name__)


@app.post("/api/webhooks/portal")
@login_required
def webhooks_portal():
    link = create_portal_session(
        current_user.organization_id,
        capabilities="manage" if current_user.is_admin else "read",
        session_id=f"user-{current_user.id}",
    )
    resp = jsonify(url=link["url"])
    resp.headers["Cache-Control"] = "no-store"
    return resp

Then the page that hosts the portal:

<iframe
  id="webhooks-portal"
  title="Webhooks"
  allow="clipboard-write"
  referrerpolicy="no-referrer"
  style="width: 100%; height: 720px; border: 0"
></iframe>
<script>
  fetch("/api/webhooks/portal", { method: "POST", credentials: "same-origin" })
    .then((res) => res.json())
    .then(({ url }) => {
      document.getElementById("webhooks-portal").src = url;
    });
</script>
import { useEffect, useState } from "react";

export function WebhooksPortal() {
  const [url, setUrl] = useState<string | null>(null);

  useEffect(() => {
    let cancelled = false;
    fetch("/api/webhooks/portal", { method: "POST", credentials: "same-origin" })
      .then((res) => res.json())
      .then((data) => !cancelled && setUrl(data.url));
    return () => {
      cancelled = true;
    };
  }, []);

  if (!url) return <p>Loading webhooks…</p>;
  return (
    <iframe
      key={url} // a new link needs a fresh frame
      src={url}
      title="Webhooks"
      allow="clipboard-write"
      referrerPolicy="no-referrer"
      style={{ width: "100%", height: 720, border: 0 }}
    />
  );
}

allow="clipboard-write" lets customers copy their signing secret from inside the frame. The iframe only loads on origins listed in the portal settings, because the portal page is served with Content-Security-Policy: frame-ancestors 'self' <your origins>. Elsewhere the browser refuses to frame it. In React development mode, Strict Mode runs effects twice and mints two links. Only the one that loads is used, and the other expires unused after 15 minutes.

Portal endpoints page branded Lumen Billing for Acme Corp with an Add endpoint button in the violet accent colour and one active endpoint
The landing page of a session: the customer's endpoints, in your accent colour.

Redirect instead of embedding

If you'd rather not frame the portal, send the user to it. Use a 303 redirect from a route that requires sign-in. No allowed origin is needed for this, and it is also the easiest way to try the portal on localhost.

app.get("/settings/webhooks/open", requireUser, async (req, res) => {
  const { url } = await createPortalSession(req.user.organizationId, { session_id: `user-${req.user.id}` });
  res.set("Cache-Control", "no-store").redirect(303, url);
});
func openPortal(w http.ResponseWriter, r *http.Request) {
    user := currentUser(r)
    link, err := CreatePortalSession(r.Context(), user.OrganizationID, PortalSessionOptions{SessionID: "user-" + user.ID})
    if err != nil {
        http.Error(w, "could not open the webhooks portal", http.StatusBadGateway)
        return
    }
    w.Header().Set("Cache-Control", "no-store")
    http.Redirect(w, r, link.URL, http.StatusSeeOther)
}
from flask import redirect


@app.get("/settings/webhooks/open")
@login_required
def open_webhooks_portal():
    link = create_portal_session(current_user.organization_id, session_id=f"user-{current_user.id}")
    resp = redirect(link["url"], code=303)
    resp.headers["Cache-Control"] = "no-store"
    return resp

Point the Refresh URL setting at this route. When a session expires, the portal shows a button that opens it, and the user lands in a fresh session.

End sessions on sign-out

Sessions end on their own after ttl. To end them sooner, for example when the user signs out of your app or loses access to the organization, call the expire endpoint with the same session_id you minted with, or without one to end every open session of that customer:

await endPortalSessions(user.organizationId, `user-${user.id}`);
ended, err := EndPortalSessions(ctx, user.OrganizationID, "user-"+user.ID)
end_portal_sessions(current_user.organization_id, f"user-{current_user.id}")
curl --user "$RELAY_KEY:$RELAY_SECRET" \
  -H 'Content-Type: application/json' \
  -X POST https://my.webhookrelay.com/v1/outbound/consumers/acme_corp/portal-sessions/expire \
  -d '{"session_id": "user-123"}'
# {"ended":1}

An open portal page shows that the session ended on its next request, with the refresh button if you configured one.

What your customer sees

The customer adds its own endpoint with the same form you use in the dashboard: destination, event types, optional channels and a payload filter, rate and timeout, and an optional existing signing secret to import.

Add endpoint dialog inside the customer portal with destination URL https://hooks.acme.example/lumen, description Finance team alerts, All events selected and a payload filter amount greater than or equal to 10000
A customer registering an endpoint that only receives invoices of 10,000 or more.

Send test event delivers a signed test straight away, and the customer sees the attempt and the response its server returned. Test events count toward your account's 100 test events per 24 hours, not toward the monthly message quota.

Portal message page for a test invoice.paid event showing the payload and one delivered attempt with HTTP 200
A test event in the portal: payload, endpoint and every attempt.

The Event catalog tab lists your non-deprecated event types with their descriptions and example payloads, so customers know what to subscribe to. Write good description and example values when you create event types.

Portal event catalog listing invoice.paid, invoice.payment_failed, subscription.canceled and subscription.updated with descriptions
The event catalog tab, built from your event types.

Open a customer's portal from the dashboard

Support teams can see exactly what a customer sees. On a consumer's page in Outbound webhooks, Open portal opens a manage session for that consumer in a new tab. Changes made there are audited under your name.

Environments

A portal session belongs to the environment it was created in, and the portal acts only there. To give a customer the portal for your staging environment, send the environment header when you mint the link:

curl --user "$RELAY_KEY:$RELAY_SECRET" \
  -H 'Content-Type: application/json' \
  -H 'X-Outbound-Environment: staging' \
  -X POST https://my.webhookrelay.com/v1/outbound/consumers/acme_corp/portal-sessions \
  -d '{}'

An access token bound to one environment always mints sessions there. Branding and allowed origins are shared by all environments.

Security checklist

Before you ship

  • Mint links on your server only. Your Webhook Relay credentials must never reach browser code.
  • Map the signed-in user to their own consumer ID on the server. Never take the consumer ID from the request.
  • Use read sessions for users who shouldn't change webhook settings.
  • Return the link with Cache-Control: no-store, never log it, and mint a new one on every page load.
  • List only your own app's origins in Sites allowed to embed the portal.
  • End sessions with the expire endpoint when a user signs out or leaves the organization.

API and MCP reference

ActionRESTMCP tool
Create a portal linkPOST /v1/outbound/consumers/{id}/portal-sessionscreate_outbound_portal_session
End sessionsPOST /v1/outbound/consumers/{id}/portal-sessions/expireend_outbound_portal_sessions
Read settingsGET /v1/outbound/portal-settingsget_outbound_portal_settings
Replace settingsPUT /v1/outbound/portal-settingsupdate_outbound_portal_settings

The MCP tools are available to MCP clients and the dashboard agent, so you can ask it to "open the portal for acme_corp" or "allow https://app.example.com to embed the portal". The portal's own /v1/portal API accepts only portal sessions, never account tokens, and is not meant to be called from your code.

Next steps

Frequently asked questions

Does Webhook Relay have an embeddable webhook portal for my customers?

Yes. The Outbound Gateway includes a customer portal on every plan, Free included. Your backend creates a portal session for one consumer with POST /v1/outbound/consumers/{id}/portal-sessions and gets a single-use URL. You show that URL in an iframe in your app, or redirect to it. In the portal, the customer adds and edits its endpoints, reveals or rotates signing secrets, sends test events, browses your event catalog and reads, retries and recovers its own deliveries.

How do I embed the Webhook Relay portal in an iframe?

Add your app's https origin to the portal settings' allowed origins, for example https://app.example.com or https://*.example.com. Then, on each page load, have your server create a portal session for the signed-in customer and return its url to the browser. Set that url as the iframe's src, with allow=clipboard-write so customers can copy their signing secret. The portal page is served with a frame-ancestors policy that names only your allowed origins.

How long does a portal link last?

The link is single-use and must be opened within 15 minutes. After it is opened, the session lasts the ttl you asked for: 1 hour to 7 days, 12 hours by default. An expired session shows a message and, if you set a refresh URL, a button back to your app so it can create a new link. You can end a customer's sessions early with POST /v1/outbound/consumers/{id}/portal-sessions/expire, for example when your user signs out.

Can I give a customer read-only access to the portal?

Yes. Create the session with capabilities set to read. A read session can browse endpoints, the event catalog and delivery history but can't add, change, pause, delete, test or recover anything. The default, manage, allows all of those.

Can I brand the portal?

Yes. Portal settings set the name shown in the header, a logo URL, an accent colour for buttons and links, and the theme (follow the visitor, light or dark). The portal shows your branding with a small 'Delivered by Webhook Relay' footer link. A custom portal domain isn't available yet.

Did this page help you?