Customer.io
Customer.io is a platform for automated messages to customers. Its campaigns have the Send and receive data block — a webhook whose method, headers and body you set yourself. Pointed at the Flows address, it sends the events of your campaigns into flows: an order is placed or paid, a cart is left, a form is filled in — and a flow takes it from there with Viber, SMS, waiting and reminders. To send SMS directly from Customer.io, see Customer.io.
This page is written from the public documentation of Customer.io and has not been checked on a live account yet.
What you need
- A Customer.io workspace with campaigns. The page of the action does not name a plan.
- Nothing else: the block takes any method, headers and body.
- One address for all campaigns: the event is written in the body.
Step 1. Create a connection
- Open
Flows → Connections, press Connect a system and choose Customer.io. - Press Copy address. It looks like
https://events.alphasms.net/hooks/<TOKEN>— keep it secret.
Step 2. Add the block to a campaign
- Open the campaign (workflow), drag the Send and receive data block to the place where the event should go and press Add Request.
- Method —
POST(set by default). URL — the address from the cabinet. - Headers —
Content-Type: application/jsonis already there. No authorization: the secret is in the address. - Body — paste the body below. Change
order_paidineventto the event of this campaign (see Events). - Sending behavior — Send automatically. The default is Draft.
The body (Liquid; the json filter puts the quotes and escapes the value itself):
{
"event": "order_paid",
"message_id": "cio:{{delivery_id}}",
"contact": {
"external_id": {{ customer.id | default: '' | json }},
"phone": {{ customer.phone | default: '' | json }},
"email": {{ customer.email | default: '' | json }}
},
"traits": { "first_name": {{ customer.first_name | default: '' | json }} },
"properties": {
"order_id": {{ event.order_id | default: '' | json }},
"total": {{ event.total | default: 0 | json }}
},
"context": { "source": "customer_io", "campaign_id": {{ campaign.id | json }} }
}
{{delivery_id}}is the id of this message for this person. Customer.io retries with the same id, so a retry is not recorded twice.{{customer.id}}is usually the id of the customer in your own system — that is how Customer.io identifies people. If your workspace identifies people by email, removeexternal_id.{{event.*}}variables exist only in campaigns started by an event. In a campaign started by a segment they give the error "undefined variable" — remove thepropertiesblock there, or keep thedefaultfilter on each.- To pass the time of the event, add the line below. That Customer.io gives this time in UTC is not confirmed by the documentation; without the line the time of the event is the time AlphaFlow receives it.
"occurred_at": "{{ event_timestamp | date: '%Y-%m-%dT%H:%M:%SZ' }}",
Step 3. Send a test
The preview on the right renders the body on a sample profile ({{delivery_id}} shows unsent there). Then run the
campaign on your own profile with a phone. The event appears in
Flows → Connections → Event journal within seconds. The
connection shows Recognised: Customer.io.
Events
| What starts the campaign | AlphaFlow event | Properties |
|---|---|---|
| An order is placed | order_created | order_id, total |
| An order is paid | order_paid | order_id, total |
| A cart is left without an order | cart_updated | the properties you add |
| A form is filled in | form_submitted | the properties you add |
Put order_paid only into a campaign whose trigger is the payment itself or whose trigger filter checks a paid
status. A campaign on any order sends order_created, and one on any change of an order — order_status_changed with
status: otherwise an unpaid order reaches the customer as "paid".
You choose the name of the event from the list of AlphaFlow. AlphaFlow takes the body as it is: the contact is the phone, the
email and your customer id from contact, the first name comes from traits. Nothing has to be mapped. The names
of the events are the ones the ready-made templates expect — see
Recommended events.
Good to know
- Customer.io waits 16 seconds for the answer. On a timeout,
408,409,429and5xxit retries up to 11 times within about an hour. A manual retry from the Sent tab takes fresh data. - Customer.io adds the headers
X-CIO-Signature,X-CIO-TimestampandX-CIO-Idempotency-Keyitself. The signature is optional — the secret in the address is enough. To check it, copy a key from Webhook signing keys (Settings → Workspace Settings → API & Webhook Credentials) into the connection as its secret. - A person without a phone in Customer.io comes with the email and the id only: a message in Viber or SMS reaches them only if AlphaFlow already knows their phone.
- The address always answers
200. Above the daily event limit the event is refused in AlphaFlow withquota_exceededand shown in the journal; the campaign in Customer.io keeps running.