Send automations to your own system with webhooks
This article shows you how to send automations to Zapier, Make or your own server with a webhook, and how to check that it came from PlayerMagick.
Available on: Pro, Business and Agency plans.
How it works
A webhook is a message PlayerMagick sends to an address you choose when an automation runs. It "Sends the email, the video, the trigger and the time, as JSON." Use it for anything your email tool can't do: a CRM, a spreadsheet, a Slack message.
A webhook sends a person's email address to your own system. That is personal data leaving PlayerMagick: mention the service that receives it in your privacy policy.
Add a webhook to an automation
- Open the automation in Automations.
- Under Do, click + Add action, then Send a webhook under Anything else.
- Paste the receiver's address in Send to, for example the address Zapier or Make gives you for a "Catch Hook" or custom webhook trigger.
- Click Save.
- Under Try it on one person, click Run to send a test (its body says
"test": true).
The address must be:
- a full
https://address on the standard port (443), - a public host name, not an IP address or a local name,
- without a user name or password in it,
- not a PlayerMagick address.
Messages you may see: "Use the full https:// address of your webhook.", "Use an https:// address.", "Use the standard https port (443).", "Use a public host name, not an IP address or a local name.", "Remove the user name and password from the address."
What is sent
One POST request per webhook action, with Content-Type: application/json and a body like this:
{
"id": "evt_9mQ2xL7aB4cD8eF1gH3jK5",
"type": "automation.action",
"to": "https://hooks.example.com/pm/bought",
"createdAt": "2026-10-21T14:12:03Z",
"test": false,
"automation": { "id": "3f6c1e2a-…", "name": "Bought" },
"trigger": {
"kind": "bought",
"at": "2026-10-21T14:12:01Z",
"video": null,
"funnel": { "id": "f_8kq2Tz4WmA1b", "name": "Spring Offer: objection funnel", "step": "q1", "answer": "Price", "variant": "b" },
"percent": null,
"moment": null
},
"person": { "email": "maria@example.com", "tool": "kit", "subscriberId": "4821", "recognisedBy": "link", "verified": true },
"sale": { "reported": true }
}
trigger.kindis the trigger, for examplewatched_percent,reached_moment,left_before,entered_email,funnel_answerorbought.videoorfunnelsays where it happened;percentandmoment(in seconds) are filled in for watching triggers.tois the address this webhook was sent to, exactly as saved in the automation.person.recognisedBysays how the person was recognised:link(a code in your email links),email_link(an email link with their address),gateorfunnel_email(they typed their email). An email typed into a form is a claim, like any form field: treat it that way.person.verifiedisfalsewhen this viewer was recognised only by an email typed on the page. Anyone can type someone else's address, so PlayerMagick only adds for such a viewer (a tag, a list, a sequence, a webhook) and never removes or changes anything in your email tool. "Bought" is never sent for them.sale.reportedis set for "Bought": the sale was reported by your thank-you page.- Never sent: the viewer's IP address, device, the page address or their country.
"Bought" means your thank-you page reported a sale. PlayerMagick does not see payments. Never deliver a product or give access from a webhook alone; check the order in your payment or checkout tool.
Check the signature
Every webhook carries these headers:
User-Agent: PlayerMagick-Webhooks/1
PlayerMagick-Event-Id: evt_9mQ2xL7aB4cD8eF1gH3jK5
PlayerMagick-Signature: t=1792764723,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
v1 is an HMAC-SHA256 (a signature made with a shared secret) of the text {t}.{your webhook address}.{the raw body}, with your account's signing secret, written in hexadecimal. The address is your receiver's address exactly as you saved it in the automation (the body's to). Because it is part of the signature, a request sent to another of your webhook addresses never verifies at yours. Your receiver should:
- Recompute the signature with its own address and the raw body, exactly as received (before any JSON parsing), and compare it with each
v1value in constant time. - Refuse the request when
tis more than 5 minutes away from your server's clock. - Ignore a
PlayerMagick-Event-Idit has already processed. Retries send the same id and the same body.
Example in Node.js
import { createServer } from 'node:http';
import { createHmac, timingSafeEqual } from 'node:crypto';
const SECRET = process.env.PLAYERMAGICK_WEBHOOK_SECRET; // pmwh_…
const MY_URL = 'https://hooks.example.com/pm/bought'; // exactly as saved in the automation
const seen = new Set(); // in production, keep processed ids in your database
function verify(rawBody, header) {
const parts = String(header || '').split(',');
const t = Number((parts.find((p) => p.startsWith('t=')) || '').slice(2));
if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false;
const expected = Buffer.from(createHmac('sha256', SECRET).update(`${t}.${MY_URL}.${rawBody}`).digest('hex'));
return parts
.filter((p) => p.startsWith('v1='))
.some((p) => {
const got = Buffer.from(p.slice(3));
return got.length === expected.length && timingSafeEqual(got, expected);
});
}
createServer((req, res) => {
let body = '';
req.setEncoding('utf8');
req.on('data', (chunk) => (body += chunk));
req.on('end', () => {
if (!verify(body, req.headers['playermagick-signature'])) return res.writeHead(401).end();
const id = req.headers['playermagick-event-id'];
if (!seen.has(id)) {
seen.add(id);
const event = JSON.parse(body);
// Your work here, for example with event.person.email and event.trigger.kind
}
res.writeHead(200).end();
});
}).listen(3000);
Answer within 10 seconds. Do slow work after you answer.
The signing secret
The signing secret is made when you save your first automation with a webhook. There is one secret for all your account's webhooks. In the automation editor, under the webhook action, owners and admins see Signing secret with Show, Copy and Make a new secret. Editors see "Ask an owner or admin for the signing secret."
To change it:
- Click Make a new secret, then confirm with Make a new secret.
- Put the new secret in your receiver.
"For the next 24 hours every webhook is signed with both secrets, so your receiver keeps accepting them while you put the new one in. After that only the new one signs." During those 24 hours the header has two v1 values; the example above accepts either.
Keep the secret private. Make a new one if it may have been seen by someone else.
Retries and errors
| Your receiver answers | What happens |
|---|---|
2xx | Done. |
408, 429, 5xx, no answer within 10 seconds, or a network error | Tried again after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours, then marked failed. A 429 with Retry-After (up to 1 hour) is respected. |
410 | Failed, and the webhook is turned off in its automation: "The receiver said this webhook is gone, so it was turned off. Save the automation to turn it back on." |
Another 4xx | Failed at once, without retries. |
A redirect (3xx) | Failed: redirects are never followed ("the webhook address redirects to another address"). Use the final address. |
- After 5 failures in a row, PlayerMagick treats the receiver as not answering: its webhooks wait, and one is tried every 5 minutes until it answers. Webhooks that wait more than 7 days are given up.
- An address that points to a private network is refused ("the webhook address points to a private network").
- PlayerMagick sends at most 10 webhooks a second for your account, and at most 4 at a time to the same address.
- Each webhook counts as one action of your monthly limit; retries don't. See Automation limits, the speed limit and pauses.
Troubleshooting
- My receiver gets nothing. Use Try it on one person and read the result line, for example "✓ Webhook to hooks.zapier.com answered 200". See Fix an automation error.
- The signature never matches. Use the raw body as received, before parsing or reformatting the JSON, the whole secret including
pmwh_, and your address exactly as saved in the automation (compare it with the body'sto: a trailing slash or a different letter case counts). - Every request is refused as too old. Check your server's clock.
- I changed the webhook address. Click Save. Waiting webhooks to the old address are cancelled ("Not done: the automation was changed before it was sent"); new ones go to the new address.