Learn Build Community Opportunities Hosted n8n Blog About Careers Contact Log in

Home / Blog / Fix

Fix

N8n MirrorFly video conferencing guide

A practical, importable n8n workflow plus tested MirrorFly auth, webhook and reconnection steps to get audio and video conferencing working reliably.

If your n8n MirrorFly video conferencing setup fails, get a working integration by using an n8n Webhook trigger, an HTTP Request node for auth and media tokens, a small Code node to cache/refresh tokens, and a reliable public webhook URL or tunnel. This post gives an importable workflow and reconnection tips.

Why it fails

Three things break most MirrorFly integrations in n8n: authentication and short lived media tokens, webhooks or websocket connections not reaching your n8n server, and NAT or TURN problems for real time media. MirrorFly often issues transient media tokens that expire, and WebRTC needs STUN/TURN to traverse home or office NATs. If your webhook registration points to a private IP or uses an invalid certificate, MirrorFly cannot deliver events.

Step-by-step fix and importable n8n workflow

  1. Expose n8n publicly. If n8n is self hosted, use a stable domain and HTTPS. Use a reverse proxy with a real certificate, or a tunnel like Cloudflare Tunnel or ngrok for testing. Ensure the webhook URL is reachable from the internet at a persistent address.
  2. Create the webhook trigger node. In n8n add a Webhook node, set Method to POST, and set a clear path, for example /mirrorfly-events. For Response Mode choose to respond immediately so MirrorFly does not wait for a long processing chain.
  3. Register the webhook in MirrorFly. Use the MirrorFly dashboard or their webhook registration API to point to your full webhook URL, for example https://yourdomain.com/webhook/mirrorfly-events. If the API requires a secret, configure it and add it as a header in the webhook node verification step.
  4. Obtain API credentials. From the MirrorFly developer console get the API key and API secret or service account token. Store these securely in n8n credentials or environment variables, not in workflow nodes.
  5. Get media tokens on demand. Add an HTTP Request node named Get Media Token that calls MirrorFly token endpoint (check your MirrorFly docs for exact path). Use method POST, include your API key in headers, and ask for a token tied to the participant or room. Save response fields token and expires_in into the output.
  6. Cache and refresh tokens. Add a Code node that inspects the cached token expiry, and only calls Get Media Token when the token is missing or will expire in the next 30 seconds. Example logic is in the code block below.
  7. Forward events to your business logic. Chain the webhook to nodes that update room state, notify participants, or call MirrorFly APIs via HTTP Request. If MirrorFly sends websocket events, convert them in MirrorFly to REST webhook callbacks or use a WebSocket client that reconnects.
  8. Activate and test. Enable workflow and simulate events. Watch n8n executions and MirrorFly logs. Use the webhook test tool in MirrorFly or use curl to POST to your webhook URL and confirm 200 responses.
// Example Code node snippet to refresh and cache token in workflow context
const key = 'mirrorfly_media_token';
const meta = await $workflowStatic.getWorkflowStaticData('global');
const now = Date.now();
if (!meta[key] || meta[key].expiresAt - 30000 < now) {
  // call the HTTP Request node named Get Media Token
  const res = await $node['Get Media Token'].run();
  const token = res[0].json.token;
  const expiresIn = res[0].json.expires_in * 1000; // ms
  meta[key] = { token, expiresAt: now + expiresIn };
  await $workflowStatic.setWorkflowStaticData('global', meta);
}
return [{ json: { token: meta[key].token } }];

n8n MirrorFly video conferencing: node and credential notes

Use the Webhook trigger node for inbound MirrorFly events. Use HTTP Request to call MirrorFly REST endpoints for auth, room creation and token issuance. Use the Code node for small JS checks like token TTL, exponential backoff counters and websocket reconnect metadata. Put API keys in n8n Credentials so you never paste them in the workflow JSON.

When you activate the workflow, n8n gives each webhook a permanent URL. If you change paths or domain, re-register the webhook in MirrorFly. If you see 401 or 403 errors, check the header name MirrorFly expects for the API key and whether a signature header is required.

NAT, firewall, STUN, TURN and media path troubleshooting

WebRTC needs direct UDP or TCP connections. If participants report one-way audio, packet loss or no video, configure TURN servers and ensure UDP port 3478 or the ports your TURN server uses are allowed. For Nigerian home or cheap office networks, symmetric NATs break peer to peer without a TURN. Run a coturn server or use MirrorFly hosted TURN if provided.

Also confirm:

  • Your webhook URL is HTTPS with a valid certificate, browsers and MirrorFly will reject self signed certs.
  • Any corporate firewall allows outgoing connections to MirrorFly and to your TURN/STUN server.
  • If n8n is behind NAT, forward ports for the tunnel or use Cloudflare Tunnel to avoid intermittent IP changes.

Reconnection strategies and monitoring

Design for token expiry and connection drops. Practical steps:

  • Refresh media tokens 30 seconds before expiry. Use a scheduled n8n Cron node that runs a token refresh workflow for long running rooms.
  • For websockets, implement client side ping/pong and exponential backoff reconnects. On server side, accept reconnections and reassign participant state by room ID rather than by socket ID.
  • Use a small health-check HTTP endpoint and an n8n workflow to alert you if MirrorFly webhooks stop arriving for a room (see our post on fix n8n webhook not receiving data).

When to get help

If after following this guide you still have 401, 403 or persistent websocket disconnects, check the MirrorFly developer console for webhook delivery logs. Search or post your exact error and request/response headers to the n8n forum; see threads like n8n MirrorFly Developer for Video Conferencing Automation and general n8n production advice at Best tutorial to learn n8n for production. If the issue is NAT or TURN, a systems admin who can configure coturn and firewall rules will save time.

Build the workflow pieces above and test one part at a time: webhook delivery, auth token exchange, then media paths. That isolates where MirrorFly cannot reach your service or where tokens expire prematurely.

Learn to build automations like this with Automate Naija.

Frequently asked questions

Do I need a public domain and TLS for MirrorFly webhooks to reach n8n?

Yes. MirrorFly requires a reachable HTTPS endpoint. Use a valid TLS certificate and a stable domain or a production tunnel. Self signed certificates and private IPs will usually be rejected, causing webhook delivery failures.

How do I handle short lived media tokens in n8n?

Request tokens via an HTTP Request node and cache them with a Code node or external store. Refresh tokens 30 seconds before expiry, or run a Cron workflow to renew tokens for active rooms.

What NAT or firewall rules cause one way audio or no video?

Symmetric NATs and blocked UDP ports break WebRTC. Ensure your TURN/STUN servers are reachable, open the ports your TURN uses (commonly UDP/TCP 3478), or use a hosted TURN service to relay media reliably.

How do I keep a MirrorFly websocket connection stable in n8n?

Use client side ping/pong, implement exponential backoff reconnection, and re-establish auth tokens before reconnect. On the server side, accept reconnections and reattach participant state by room ID rather than socket ID.


Build it with us. The community is free and the build track teaches this kind of automation week by week: see pricing or join the community.

Keep reading

A new fix lands here every morning, picked from what builders are stuck on right now.