Skip to content
Foo GuardDocs
DOCUMENTATION

Gateway webhook notifications

Configure signed Gateway alerts, verify deliveries, and recover from receiver failures.

Page text and source link for your AI assistant. Nothing is sent automatically.

Connect your alerting service

Workspace owners and administrators can open Gateway → Alerts → Get notified. Notifications work in both Monitoring & Audit and Enforcement. Start with blocked requests and uncertain outcomes; add flagged requests when you want notifications for Monitoring concerns.

  1. Enter an HTTPS destination you own or are authorized to use. It must be reachable on the public internet using the standard HTTPS port, without redirects, query parameters, or URL credentials. Private network endpoints are not supported.
  2. Select events, enter a reason, and save. Saving pauses notifications and creates a signing secret shown only once. Store it in your receiver's server-side secret store.
  3. Verify signatures in your receiver and return a 2xx response within eight seconds after durably accepting the message.
  4. Select Send test. Refresh deliveries if necessary. After a successful test, select Enable notifications. Only new matching requests are included; historical requests are not backfilled.

Test delivery confirms that the destination returned a successful HTTP response. It cannot prove that the receiver verified the signature, paged a person, or completed downstream processing. Check those in your receiving service before relying on alerts. Email and direct Slack integrations are not part of this beta; use a receiver that understands this webhook format.

Events and privacy

Event types are gateway.blocked, gateway.flagged, gateway.uncertain, gateway.budget_near_limit, gateway.budget_limit_reached, gateway.credential_replaced, gateway.catalog_entry_blocked, gateway.catalog_entry_cleared, gateway.approval_requested, and gateway.test. A pending request is not notified until an outcome is available. An uncertain outcome takes priority over the request's decision. Blocked requests can occur in either mode when Gateway stops an unsafe or invalid dispatch. Alerts never change the deterministic decision.

Each message contains id, type, version (currently 1), created_at, and workspace_id. Request events also contain request with id, agent_id, tool_name, rule, policy_version, mode, decision, outcome, and created_at. Test messages contain test: true and a synthetic message, without a request.

Arguments, tool responses, credentials, and administrator reasons are not sent. Tool names and workspace/agent identifiers are still organizational metadata: send only to authorized destinations. Treat all message values as untrusted display text. Link back to the workspace's Gateway Requests page to investigate, add a scoped exception or deny rule, or block an agent.

Model budget notifications

Select Model budget near limit or Model budget limit reached to receive notifications when workspace model spending plus reserved funds reaches 80% or 100% of a positive monthly allowance. These events are optional. They use the same destination, signature, test, retry and recovery controls as request notifications.

Budget messages contain budget instead of request: periodStart (UTC month start), limitMicroUsd, spentMicroUsd, reservedMicroUsd, and thresholdPercent (80 or 100). Monetary values are integer millionths of a US dollar. Reserved funds include unresolved requests from earlier months. A threshold reached through reservations is not proof of that amount being billed by the provider.

The scheduler evaluates current balances and queues the highest selected threshold currently reached. It deduplicates each threshold by workspace, month, allowance and destination configuration. Changing the allowance or destination can produce a new notification. A threshold crossed and cleared between scheduler runs may not be reported. Enabling these events can notify about the current balance; this differs from tool events, which are not backfilled. Budget alerts cover the workspace allowance, not individual agent allowances or request-capacity limits. Rejected model attempts do not generate tool-request alerts.

Alerts are advisory. Budget admission is enforced synchronously and does not wait for a notification. See model routing and spending controls for reservations and recovery.

Key replaced notifications

Select Key replaced (`credential_replaced`) to be told when StackHangar replaces a server's key (see Update keys from StackHangar). It uses the same destination, signature, test, retry and recovery controls. The type is gateway.credential_replaced.

The message has the usual id, type, version, created_at and workspace_id, plus slot (kind and id: the server), token_id (which token was used) and replaced_at. It has no request. The key, and anything derived from it, is never included. The message is sent only after the new key has been tested and swapped in. Example with made-up ids:

{
  "id": "6f1c1b0e-0000-4000-8000-000000000001",
  "type": "gateway.credential_replaced",
  "version": 1,
  "created_at": "2026-11-08T18:00:05.000Z",
  "workspace_id": "6f1c1b0e-0000-4000-8000-000000000002",
  "slot": { "kind": "mcp-server", "id": "6f1c1b0e-0000-4000-8000-000000000003" },
  "token_id": "6f1c1b0e-0000-4000-8000-000000000004",
  "replaced_at": "2026-11-08T18:00:04.000Z"
}

Catalog entry notifications

Not active yet: these events start only after migration 135 is applied and the scheduled catalog Pulse evaluation is switched on for this deployment.

Select Catalog entry blocked or Catalog entry cleared to be told when the scheduled Pulse evaluation of your active approved catalog changes an entry's state. You get one message per change between blocked and clear, never one per evaluation; a blocked entry whose reason code changes sends nothing new. The types are gateway.catalog_entry_blocked and gateway.catalog_entry_cleared.

These are notifications. Today they do not change Gateway decisions: only Gateway-server entries can be bound to agents, and a blocked Gateway-server entry (its server was removed) is already denied as retired. Blocking of bound Team and public Library entries applies once Library entries can be bound. Switching the evaluation off does not clear existing blocks or send a cleared message.

The message has the usual fields plus catalog: version (catalog version), entry_key, state (blocked or clear), reason_code (one of kind_mismatch, team_version_missing, team_version_retired, team_policy_failed, team_unsupported, team_unpublished, public_unavailable, public_sha256_mismatch, public_policy_failed, gateway_server_removed, or clear), signal_id (a UUID for this change), evaluated_at, agent_ids (up to 50 catalog-required agents bound to the entry) and agent_count. It has no request, configuration content or findings.

Approval requested notifications

Select Approval requested to be told when a Gateway call is held for an administrator's approval (see Require approval for risky tool calls). It uses the same destination, signature, test, retry and recovery controls. The type is gateway.approval_requested; it is sent once for each held call, when the hold is created.

The message has the usual fields plus approval: id, agent (id and name), server (id and alias), tool, expires_at and approval_url, the Foo Guard page where an administrator signed in to that workspace can approve or deny. It has no request and never includes the call's arguments, which only the approving administrator can read. Agent and server names are text your workspace chose: treat them as untrusted display text. Example with made-up ids:

{
  "id": "6f1c1b0e-0000-4000-8000-000000000005",
  "type": "gateway.approval_requested",
  "version": 1,
  "created_at": "2026-11-09T18:00:05.000Z",
  "workspace_id": "6f1c1b0e-0000-4000-8000-000000000002",
  "approval": {
    "id": "6f1c1b0e-0000-4000-8000-000000000006",
    "agent": { "id": "6f1c1b0e-0000-4000-8000-000000000007", "name": "Support bot" },
    "server": { "id": "6f1c1b0e-0000-4000-8000-000000000003", "alias": "notes" },
    "tool": "delete_note",
    "expires_at": "2026-11-09T18:15:05.000Z",
    "approval_url": "https://fooguard.com/gateway/approvals/6f1c1b0e-0000-4000-8000-000000000006"
  }
}

Do not approve anything from a notification alone: open the link, sign in and read the arguments. A notification that never arrives does not release the call; it stays held until it expires after 15 minutes.

Verify the signature

Headers are X-FooGuard-Delivery, X-FooGuard-Timestamp (Unix seconds), and X-FooGuard-Signature (v1= followed by lowercase hexadecimal HMAC-SHA256). The signed bytes are the timestamp, a period, and the exact raw UTF-8 request body. The secret is used as its displayed text, not decoded from hex.

This Node.js example verifies the raw body before parsing JSON. Enforce a 64 KiB request limit in your HTTP server and keep its clock synchronized. The delivery header must match the signed payload ID.

import { createHmac, timingSafeEqual } from 'node:crypto';

export function verify(rawBody, headers, secret) {
  const timestamp = headers.get('x-fooguard-timestamp') ?? '';
  const signature = headers.get('x-fooguard-signature') ?? '';
  if (!/^\d{10}$/.test(timestamp) ||
      Math.abs(Date.now() / 1000 - Number(timestamp)) > 300 ||
      !/^v1=[a-f0-9]{64}$/.test(signature)) return false;
  const expected = createHmac('sha256', secret)
    .update(timestamp + '.').update(rawBody).digest();
  if (!timingSafeEqual(expected, Buffer.from(signature.slice(3), 'hex'))) return false;
  const event = JSON.parse(rawBody.toString('utf8'));
  return event.id === headers.get('x-fooguard-delivery');
}

Reject malformed JSON and invalid signatures. After verification, validate the version and event fields, and atomically store the delivery ID with your work item. Return 2xx for an already accepted ID. This prevents duplicate actions if a response is lost or a worker restarts. Keep deduplication records at least as long as your delivery history: administrators can manually retry old failures. Never automatically retry the underlying agent tool call just because a notification arrives; an uncertain tool outcome may already have executed.

Delivery, failure and recovery

A separate scheduler checks for work about every five minutes. Scheduling can be delayed; this beta has no guaranteed notification latency. The Alerts page shows the last completed delivery run and warns after 15 minutes without one. Refresh to see current status. Contact support if scheduler delay persists.

Delivery is at least once when successful, not exactly once or guaranteed. Non-2xx responses (including redirects), timeouts, invalid DNS destinations, and connection failures retry up to five total attempts. Minimum backoffs are one minute, five minutes, 15 minutes, and one hour; actual attempts wait for a scheduler run. An interrupted attempt can be repeated after its two-minute lease expires. A response lost after acceptance can cause a duplicate notification.

The current scheduler claims up to 100 deliveries per run, at most 50 per workspace, with 25 concurrent sends. Bursts can create a backlog. The pending count includes that backlog. This beta is intended for modest alert volume; avoid enabling flagged events for every high-volume request without considering the receiving service's capacity.

Use Show failed deliveries to inspect the latest 50 failures, fix the receiver, then Retry. Retrying moves the item out of the failed view so older failures can be reached on refresh. It starts a new set of five attempts with the same delivery ID. Only failures for the current destination configuration can be retried. HTTP status codes and safe error categories are shown; response bodies are not stored.

Pause notifications cancels queued request alerts. A send already in flight may arrive. Resuming affects new events only. Save changes & rotate secret cancels pending and failed deliveries, replaces the destination configuration and secret, and requires another successful test before enabling. Update your receiver immediately; in-flight requests signed with the previous secret may still arrive. If the secret is lost, rotate it. Remove destination deletes the destination and encrypted secret and cancels queued work.

Configuration changes are recorded in the workspace audit log. Delivery metadata remains until workspace deletion, alongside Gateway request history. Removing a destination does not erase delivery history. External receivers control their own retention. Learned behavior/anomaly notifications and email remain outside this release.

Related pages

Build confidently. Keep your agents accountable.Get help ↗
Search Foo Guard Docs