Skip to content

Webhooks

A webhook is an address Mirage calls when something happens: a profile started, its proxy failed, an agent waits for your approval, a scenario finished. Point it at n8n, Make, Zapier or your own server to post to a chat, update a table or start the next step.

The webhooks on the This computer tab are sent by the app on your computer. They carry what you see in Mirage: profile names, folders and tags. They go out while the app is open. Team webhooks are sent by the Mirage server, even when every app is closed; see Team webhooks.

Add a webhook

  1. Open Automation, find Webhooks and choose Add webhook.
  2. Paste the Address: the webhook URL from n8n (a Webhook node), Make (a Custom webhook), Zapier (Webhooks by Zapier, Catch Hook) or your server. An address on this computer or your network works too, for example http://localhost:5678/webhook/… for n8n on the same machine.
  3. Choose the Events, or keep All events.
  4. Copy the secret Mirage shows. It is shown once; New secret makes another one at any time, and the old one stops working at once.

Send a test sends a webhook.test event at once. Recent deliveries shows what went out and what the receiver answered. The switch next to a webhook turns it off without deleting it.

Events

Event When data
profile.started A profile opened profile
profile.stopped A profile closed profile, reason: requested, window_closed…
profile.crashed The browser of a profile crashed profile, reason
profile.proxy_failed A running profile could not connect through its proxy, or the proxy was taken away profile, issue, failure: auth, refused, timeout…, host
agent.approval_requested An AI agent waits for your approval profile, approval: id, client, tool, action, origin, classes, reason, expiresAt
scenario.succeeded, scenario.failed A scenario run ended; a stopped run counts as failed profile, run: id, scenarioId, scenario (its name), state, steps, error, startedAt, endedAt, batchId (null outside a batch run)

profile is { "id", "name", "status", "folder", "tags" }. An approval never carries the screenshot or the full address of the page: open Mirage to see them and decide.

The request

Each event is a POST with JSON:

{
"id": "01938a6e-…",
"type": "profile.started",
"at": "2026-12-04T10:15:02.120Z",
"source": "device",
"data": {
"profile": { "id": "…", "name": "Shop US 12", "status": "Warm-up", "folder": "Ads", "tags": ["fb", "us"] }
}
}

Headers: mirage-event is the type, mirage-delivery is the delivery’s id, and mirage-signature is t=<unix time>,v1=<signature>.

Answer with any 2xx code within 10 seconds. Otherwise Mirage sends the same event again, with the same id, after 10 seconds, 30 seconds, 2 minutes and so on, for about 24 hours while the app is open. Drop an event whose id you have already seen.

Check the signature

The signature is HMAC-SHA256 of t, a dot and the raw body, with the webhook’s secret as the key, in hex. The SDKs check it for you, and refuse a signature older than 5 minutes:

import { verifyWebhook } from "@mirage-browser/sdk";
const event = verifyWebhook(process.env.MIRAGE_WEBHOOK_SECRET!, rawBody, req.headers["mirage-signature"]);
from mirage_sdk import verify_webhook
event = verify_webhook(os.environ["MIRAGE_WEBHOOK_SECRET"], request.body, request.headers["mirage-signature"])

Check the raw body as it arrived: JSON parsed and printed again may differ by a space and fail the check. In n8n, turn on Raw Body in the Webhook node and compare with a Crypto node (HMAC, SHA256, hex).

Team webhooks

If you manage automation in a team, the Webhooks card has a tab for that team next to This computer. Its webhooks are kept and sent by the Mirage server, so events arrive even when no app is open, and everyone who manages automation in the team sees them.

The server cannot read profile, folder or member names: they are encrypted. So team events carry ids, the type, the time and who did it. Look the names up by id with the SDK on a computer with Mirage, or use this computer’s webhooks.

The server calls https:// addresses on the internet only: it refuses private network addresses and does not follow redirects.

Event When data besides workspaceId and actor
profile.created, profile.deleted A profile was added to the team or deleted profileId
profile.started, profile.stopped A member opened or closed a team profile; arrives once their app tells the server profileId, clientAt: the time on the device
folder.created, folder.updated, folder.deleted A folder was added, changed or deleted folderId
member.invited An invitation was made invitationId, kind: email or link, role
member.joined A member joined the team userId, role, invitationId
member.removed A member was removed or left userId, left
member.role_changed A member’s role changed userId, role, customRoleId
lease.acquired, lease.released A profile was taken on a device or released profileId, epoch
lease.expired, lease.broken A hold on a profile expired or was broken profileId, epoch

actor is { "userId", "deviceId" } of whoever made the change, or nulls when the server did. Team events have "source": "server" and an id like ev_<number>. The signature and headers are the same as for this computer’s webhooks. When the receiver does not answer with 2xx, the server tries again after 30 seconds, 2 minutes, 10 minutes and so on; the last retry comes about 24 hours after the first attempt.