Skip to main content

n8n

n8n builds workflows from nodes: a trigger node and the nodes after it. Add an HTTP Request node, and the workflow becomes a bridge to flows: whatever starts it — a webhook, a new order in a shop, a new row in Google Sheets, a schedule — sends an event to the Flows address, and the customer gets the right message in Viber or SMS.

If your system can send webhooks by itself, connect it directly, without n8n — see Connecting systems.

Written from n8n documentation

This page is written from the public documentation of n8n and has not been checked on a live account yet.

What you need​

  • n8n on your own server: the self-hosted Community edition is free, but it needs a server. n8n Cloud works too, on its paid plans.
  • One address for all workflows: the event is named in the body of each request.

Step 1. Create a connection​

  1. Open Flows → Connections, press Connect a system and choose n8n.
  2. Press Copy address. It looks like https://events.alphasms.net/hooks/<TOKEN> — keep it secret.

Step 2. Add an HTTP Request node in n8n​

  1. Open the workflow. After the trigger node press + and add HTTP Request.
  2. Method — POST; URL — the address from the cabinet.
  3. Authentication — None: the token is already in the address.
  4. Switch on Send Body. Body Content Type — JSON; Specify Body — Using JSON.
  5. Switch the JSON field to Expression mode and paste the body below.
  6. Press Execute step, then make the workflow Active.
{
"event": "order_paid",
"message_id": "n8n:order_paid:{{ $json.order_id }}",
"contact": {
"phone": {{ JSON.stringify($json.phone ?? '') }},
"email": {{ JSON.stringify($json.email ?? '') }},
"external_id": {{ JSON.stringify($json.customer_id ?? '') }}
},
"traits": { "first_name": {{ JSON.stringify($json.first_name ?? '') }} },
"properties": {
"order_id": {{ JSON.stringify($json.order_id) }},
"total": {{ $json.total ?? 0 }}
},
"context": { "source": "n8n" }
}
  • $json.order_id, $json.phone, $json.email, $json.customer_id, $json.first_name, $json.total are fields of the input data of the node. Every trigger names them its own way: replace them with the fields of your trigger.
  • JSON.stringify puts the quotes and escapes the value itself, so a quote inside a name does not break the body.
  • event — fixed text, the name of the AlphaFlow event for this workflow (see Events).
  • message_id makes the event unique: a request with an id AlphaFlow already has is not recorded twice. For a workflow that runs on every status change, add the status to it.
  • contact needs at least one of the phone, the email or the customer id. context.source stays as it is: by it the connection shows Recognised: n8n.

Instead of filling the fields, you can press Import cURL and paste a ready command. The values are then imported as strings: for numbers switch to Using JSON afterwards. The body is already in the AlphaFlow format, so nothing has to be mapped in the cabinet — see Event format.

Step 3. Send a test​

Press Execute step on the HTTP Request node: it sends a request with the data of the trigger. The event appears in Flows → Connections → Event journal within seconds. The connection shows Recognised: n8n.

Events​

One workflow sends one event. Put into event the name that matches the trigger:

What starts the workflowAlphaFlow eventProperties
A new orderorder_createdorder_id, total
An order is paidorder_paidorder_id, total
The status of an order changesorder_status_changedorder_id, status
A new form entryform_submittedform
A new leadlead_submitted—
An appointment is madeappointment_scheduledvisit_at

Put a name like order_paid or order_shipped only into a workflow whose trigger means exactly that, or put an If or Filter node before HTTP Request that lets through only that status, for example "Paid". A workflow on any change of an order sends order_status_changed with the status property: otherwise a partly paid or returned order reaches the customer as "paid".

The contact is found by contact.phone, contact.email and contact.external_id; traits.first_name is the name the texts greet with. The names of the events are the ones the ready-made templates expect — see Recommended events.

Good to know​

  • The page of the node does not describe repeats. Nodes have a retry option in Settings; that it works the same in your version is not confirmed by the documentation.
  • A request with no phone, no email and no customer id cannot reach a person: the event is refused with no_contact, and the journal shows it.
  • The address always answers 200. Above the daily event limit the event is refused in AlphaFlow with quota_exceeded and shown in the journal; the workflow keeps running.

n8n documentation​