n8n Integration
Connect SNG Lead Recovery to n8n — cloud or self-hosted — and process abandoned leads in your own automation workflows.
Available from version 1.1.0
Integrations are available in SNG Lead Recovery 1.1.0 and newer.
Before You Start
- SNG Lead Recovery 1.1.0 or newer, set up as described in Initial Setup
- An n8n instance (n8n Cloud or self-hosted) reachable from the internet over HTTPS
Self-hosted n8n
SNG Lead Recovery only sends to https:// URLs. A self-hosted n8n must be publicly reachable with a valid SSL certificate — http:// or local network addresses will not work.
Step 1: Create a Workflow with a Webhook Node
- In n8n, create a new workflow.
- Add the Webhook trigger node.
- Set HTTP Method to POST.
- Set the response to be sent immediately, so SNG Lead Recovery gets a fast response.
n8n shows two URLs: a Test URL and a Production URL.
| URL | When it works |
|---|---|
| Test URL | Only while you click Listen for test event in the editor — use it for setup |
| Production URL | Only while the workflow is Active — use it for real leads |
Step 2: Send a Test
- In n8n, copy the Test URL and click Listen for test event.
- In WordPress, go to SNG Lead Recovery → Settings → Recovery Delivery & Integrations.
- Choose External system via webhook, paste the Test URL into Webhook URL, keep both Send Events on, and click Save & Send Test.
n8n receives the sample lead (Jane Doe). The data is in the body of the webhook output: body.first_name, body.email, body.resume_link, body.event, and so on.
Step 3: Branch by Event
Add a Switch node after the Webhook with rules on {{ $json.body.event }}:
| Output | Rule | Use |
|---|---|---|
| Abandoned | equals lead.abandoned |
Start follow-up |
| Finished | equals lead.completed |
Stop follow-up |
| Recovered | equals lead.recovered |
Stop follow-up, count a recovery |
Then connect the nodes you need — for example Google Sheets, HubSpot, Slack, Send Email, or an HTTP Request to your own CRM.
Step 4: Go Live
- Save the workflow and switch it to Active.
- Copy the Production URL from the Webhook node.
- In WordPress, replace the Test URL with the Production URL and click Save Changes.
Warning
The Test URL stops working when you stop listening. Always switch to the Production URL before going live, or real leads will fail to deliver.
Optional: Verify the Signature
If you set a Signing Secret in SNG Lead Recovery, each request includes an X-SNG-Signature header. To verify it in n8n:
- In the Webhook node options, enable Raw Body.
- Add a Crypto node: action Hmac, type SHA256, using your Signing Secret, over the raw body.
- Add an IF node comparing
sha256=+ the result with thex-sng-signatureheader — stop the workflow if they don't match.
See the Custom Webhook reference for details.
SMS Consent
The phone field is only filled when the visitor gave marketing consent, and sms_consent is true/false. If your workflow sends text messages, add an IF node on {{ $json.body.sms_consent }} is true before the SMS node.
Troubleshooting
| Problem | What to check |
|---|---|
| Test fails in WordPress | Click Listen for test event in n8n first, and use the Test URL. The URL must be https://. |
| Real leads don't arrive | The workflow must be Active and WordPress must use the Production URL. Check the lead's timeline for Sent to Webhook. |
| Fields are empty | Read them from body — for example {{ $json.body.email }}. |
| Self-hosted n8n unreachable | It needs a public https:// address with a valid certificate. |