FleetDeckDocs

Integrations

n8n

Receive signed FleetDeck webhooks in n8n, verify them in a Code node and run sequences with the HTTP Request node.

Receive run results

  1. Add a Webhook node: HTTP Method POST, Respond Immediately. Under Options turn on Raw Body so the exact signed bytes are kept.
  2. Copy the Production URL (it must be public https) into a Webhook alert in Automations → Alerts.
  3. Activate the workflow and press Send test in FleetDeck.

Verify the signature in a Code node

Code node
// n8n Code node, "Run Once for All Items", directly after a Webhook node with Raw Body enabled.
// Self-hosted n8n: allow the module with NODE_FUNCTION_ALLOW_BUILTIN=crypto.
const crypto = require("crypto");
const secret = $env.FLEETDECK_WEBHOOK_SECRET; // or paste the whsec_ value from a credential
const item = $input.first();
const raw = (await this.helpers.getBinaryDataBuffer(0, "data")).toString("utf8");
const header = item.json.headers["x-fleetdeck-signature"] || "";
const parts = Object.fromEntries(header.split(",").map(p => [p.slice(0, p.indexOf("=")), p.slice(p.indexOf("=") + 1)]));
const t = Number(parts.t);
const expected = crypto.createHmac("sha256", secret).update(`${t}.${raw}`).digest();
const given = Buffer.from(/^[0-9a-f]{64}$/.test(parts.v1 || "") ? parts.v1 : "", "hex");
const fresh = Number.isInteger(t) && Math.abs(Date.now() / 1000 - t) <= 300;
if (!fresh || given.length !== expected.length || !crypto.timingSafeEqual(given, expected)) {
  throw new Error("Invalid FleetDeck signature");
}
return [{ json: { delivery: item.json.headers["x-fleetdeck-delivery"], ...JSON.parse(raw) } }];

The node stops the workflow on a bad or stale signature and outputs the parsed event plus the delivery id. Store the whsec_ secret as an environment variable or credential, not in the node text.

Run a saved sequence

Create a key in the agents dashboard for the phone. Give it devices:read to list sequences and devices:control to run them. Store the fd_ token in your tool’s secret or credential store, never in a step’s visible text. In n8n create a Header Auth credential with name Authorization and value Bearer fd_….

  1. HTTP Request node: Method POST, URL https://fleetdeck.co/api/v1/devices/{deviceId}/sequence-runs.
  2. Authentication: Generic Credential Type → Header Auth, using the credential above.
  3. Send Body: JSON, with the body below. Use an expression such as {{ 'n8n-' + $json.delivery }} for requestId.
JSON body
{
  "requestId": "zap-clx9delivery0001",
  "sequenceId": "seq_123",
  "library": false
}

For a connection test, point another HTTP Request node at GET https://fleetdeck.co/api/v1/me with the same credential.