n8n, Make and Zapier
Mirage works with workflow tools in two directions:
- Events out. Mirage calls a webhook when a profile starts or crashes, a proxy fails, a scenario ends or an agent waits for you. This works with n8n, Make, Zapier and anything else that can receive a webhook, in the cloud or on your computer.
- Actions in. A workflow starts or stops a profile, checks a proxy or creates a profile. This works only from n8n that runs on the same computer as Mirage, because Mirage is controlled through its Local API, which listens on this computer only.
| Events from Mirage | Actions in Mirage | |
|---|---|---|
| n8n on the same computer | Yes | Yes |
| n8n in the cloud or on another machine | Yes, if Mirage can reach its webhook URL | No |
| Make, Zapier | Yes | No |
There is no Mirage app in the Make and Zapier catalogs, and the Mirage node for n8n is not in the npm registry yet. Until then, use the built-in webhook step of each tool, as described below.
Events in any tool
- Create the step that receives a webhook and copy its URL:
- n8n: a Webhook node, method POST.
- Make: Webhooks, Custom webhook.
- Zapier: Webhooks by Zapier, Catch Hook (a paid Zapier feature).
- In Mirage, open Automation, find Webhooks, click Add webhook and paste the URL as the Address.
- Choose the Events and save. Copy the secret Mirage shows if you are going to check the signature.
- Click Send a test. The tool receives a
webhook.testevent and learns the shape of the data.
The event’s fields are described in Webhooks. For example, data.profile.name is the profile’s name and type is the event.
Events go out while Mirage is open. If the tool does not answer, Mirage repeats the event for about 24 hours with the same id.
Check that the event is from Mirage
The webhook URL is the only protection unless you check the signature. Whoever knows the URL can send a fake event.
- n8n: the Mirage Trigger node checks it for you (see below). With the plain Webhook node, turn on Raw Body in its options and compare the
mirage-signatureheader with a Crypto node, as Webhooks describes. - Make and Zapier: neither gives the raw body to a no-code step in a way that makes the check reliable. Keep the URL secret, and do not let such a workflow do anything costly or irreversible on an event alone.
The Mirage node for n8n
The package n8n-nodes-mirage adds two nodes:
- Mirage Trigger starts a workflow on the events you choose and refuses requests that Mirage did not sign.
- Mirage manages the app on this computer: get, create, start, stop and delete profiles; list and check proxies and change a mobile proxy’s IP.
The package is not published to npm yet, so it cannot be installed from Settings, Community Nodes. It will be announced here when it is.
Set up the trigger
- Add a Mirage Trigger node and copy its production webhook URL.
- In Mirage, add a webhook with this URL and copy the secret.
- In n8n, create a Mirage Webhook Secret credential with that secret and select it in the node.
- Activate the workflow and click Send a test in Mirage. The test event starts the workflow only if the node listens to All Events or to Test; otherwise it is accepted and nothing runs, so a test does not restart a profile or post to your chat.
Set up actions
- In Mirage, open Automation. Under Local API, set a Fixed port, for example 35000, so that the address does not change between starts.
- Under API keys, click Create key and give it the permissions the workflow needs.
- In n8n, create a Mirage Local API credential: the address
http://127.0.0.1:35000and the key.
n8n must run on the same computer, directly (npx n8n or the desktop install). n8n in Docker reaches the host under another name, and the Local API refuses requests that do not come to 127.0.0.1 or localhost; on Linux, docker run --network host works. Mirage must be open.
Example: restart a crashed profile
- Mirage Trigger, event Profile Crashed.
- Mirage, resource Profile, operation Start, Profile ID
{{ $json.data.profile.id }}.
Add a Telegram or Slack node after it to be told about each restart, and a limit so that a profile that crashes at once does not restart forever.