n8n workflow

Connect an n8n workflow to WhatsApp

Turn a trusted automation event into a WhatsApp alert, preserve its context and send replies back into the workflow without custom glue code.

Level
Beginner
Time
10 minutes
Stack
n8n · HTTP · Webhooks
n8n trigger connected to ChatRail and a reply webhook
The production boundary used throughout this tutorial.
01

Prepare credentials safely

Create a workspace-scoped API key and store it in n8n credentials—not inside a node, exported workflow or browser-visible field. Use separate keys for test and production.

02

Choose a deterministic trigger

Start with a webhook, schedule or application event that includes a stable event ID. Normalize the phone number and validate required fields before the send node.

03

Configure the HTTP request

Use the ChatRail messaging endpoint with an authorization header and a deterministic idempotency key. Pass the customer-facing copy separately from structured context.

n8n HTTP Request body
{
  "connection": "operations",
  "to": "{{$json.phone}}",
  "body": "{{$json.message}}",
  "context": {
    "event_id": "{{$json.event_id}}",
    "type": "{{$json.type}}"
  }
}
04

Receive replies in a second workflow

Expose an n8n webhook for ChatRail events, verify the signature before routing and branch on event type. Keep the endpoint private from workflow editors who do not need production access.

05

Design the error route

Treat timeouts as unknown outcomes and retry with the same idempotency key. Send permanent validation errors to a review queue instead of retrying forever.

Never generate a new key for each retry.

That converts a recoverable timeout into duplicate customer messages.

06

Activate with a controlled test

Run the workflow with one allow-listed number, confirm the reply webhook, then test a timeout and a disconnected session before increasing traffic.

  • Credentials are not in exports
  • Phone input is validated
  • Replies reach the correct run
  • Retries remain idempotent
STRAIGHT ANSWERS

Questions before you build?

Start with the documentation or review the practical answers below.

Is ChatRail the official Meta Cloud API?

No. ChatRail uses a WhatsApp Linked Devices session. Review the transport trade-offs before production use.

Can I use it without AI?

Yes. Sending, delivery tracking and webhooks work without enabling AI.

Where should I start?

Use the Quickstart for your first request, then choose a workflow tutorial.