Sync Form Submits to Customer.io
Overview
A Justuno webhook can send each visitor's selected profile properties to Customer.io the moment they submit a Justuno form or even at other designated times. The webhook posts to a Customer.io form endpoint. Customer.io then creates or updates that person and records a form_submit event you can use to trigger campaigns.
What you need before you start:
- A Customer.io workspace you can add integrations to
- A Justuno workflow with a design step that has a form and a submit button (email field required)
- The HTTPS address of your website, such as
https://www.yourstore.com
Step 1: Get your site_id and form_id from Customer.io
Customer.io creates both IDs for you when you set up a custom form that uses the HTML Action attribute method.
- Log in to Customer.io and open the workspace you want the profiles sent to.
- Go to Integrations > Forms.
- Select Custom Form.
- Click View other options, then click Action attribute.
- Customer.io shows a form action URL. Copy it. It looks like this:
https://customerioforms.com/forms/submit_action?site_id=1ea07cb331d4ed0c39ba&form_id=2d75e032c78a41a&success_url=https://success.example.com/thanks(this is an example only)
Other places to find your site_id: it's the same value as the Site ID listed with your Track API credentials, under Settings > Workspace Settings > API and webhook credentials.
Tip: Use one form_id per Justuno promotion if you want Customer.io to report on each promotion separately. Reuse the same form_id if you want every promotion treated as one form.
Step 2: Create the webhook in Justuno
- In Justuno, open the workflow you want to connect. Go to the design step that has your form and submit button.
- Click the Sync To App button.
- Select Want to use a custom integration?
- If this is your first custom integration, add the HTTP client app.
- Set up the webhook with these settings:
| Setting | Value |
|---|---|
| Method | Post |
| Body Type | form-urlencoded |
| URL | The webhook URL you built in Step 1 |
| Body | The JSON payload in the next section |
| Include cart information | Unchecked |
| Include headers | Unchecked |
- Save the webhook, then save and publish your workflow.
Webhook payload
Paste this into the webhook body. Each key on the left becomes a person attribute in Customer.io. Each {{ }} value on the right is a Justuno profile property.
The json payload template below holds additional profile properties you may or may not want to include in the call to customer.io. You can delete any line items you wish to not include. You can also include additional properties as necessary
{
"email": {{email}},
"first_name": {{first_name}},
"last_name": {{last_name}},
"gender": {{sex}},
"has_children": {{children}},
"marital_status": {{married}},
"income_range": {{income_range}},
"net_worth": {{net_worth}},
"state": {{ip_region_code}},
"city": {{ip_city}},
"country": {{ip_country_code}},
"zip_code": {{ip_postal}},
[exist{sms}]
"phone": {{sms}},
"marketing_phone_status": "Opted-in",
"marketing_phone_status_date":{{updated_at[format='unix']}},
[endExist]
"popup_coupon_code":{{last_discount_code_presented}},
"created_at":{{updated_at[format='unix']}}
}
| Customer.io attribute | Justuno property | Notes |
|---|---|---|
email |
{{email}} |
Required. Customer.io uses it to identify the person. Keep the key named exactly email . |
first_name , last_name |
{{first_name}} , {{last_name}} |
Collected on the form |
gender , has_children , marital_status , income_range , net_worth |
{{sex}} , {{children}} , {{married}} , {{income_range}} , {{net_worth}} |
Profile enrichment properties, sent when available |
state , city , country , zip_code |
{{ip_region_code}} , {{ip_city}} , {{ip_country_code}} , {{ip_postal}} |
Based on the visitor's IP address |
phone |
{{sms}} |
Sent only if the visitor entered a phone number |
marketing_phone_status |
"Opted-in" |
Fixed value, sent only with a phone number |
marketing_phone_status_date |
{{updated_at[format='unix']}} |
Opt-in time as a Unix timestamp, sent only with a phone number |
popup_coupon_code |
{{last_discount_code_presented}} |
The last discount code the visitor was shown |
created_at |
{{updated_at[format='unix']}} |
Submission time as a Unix timestamp |
About [exist{sms}] … [endExist] : everything between these tags is sent only when the visitor gave a phone number. Visitors who submit only an email won't get empty phone or SMS opt-in attributes.
You can rename any key on the left to match attribute names you already use in Customer.io. Attribute names are case sensitive.
Step 3: Test the webhook and map fields in Customer.io
- In Justuno, click the vertical ellipsis icon on the webhook and click Test Webhook. Or submit your live promotion with a test email address.
- In Customer.io, go to Integrations > Forms. Your form appears there after its first submission.
- Open the form and check the field-to-attribute mapping. Click Edit next to any field to map it to a different attribute, or turn off fields you don't want captured.
- Go to People and search for your test email address. Confirm the attributes arrived.
- To follow up automatically, create a campaign triggered by this form's submission.
Troubleshooting
| Problem | Fix |
|---|---|
| The test person never shows up | Check the URL for typos in the site_id or form_id. Make sure the curly braces are removed and the method is Post. |
| Customer.io returns a 400 error | The email key must be named email . If it isn't, remap that field to email on the form's page under Integrations > Forms. |
| Attributes have the wrong names | Rename the keys in the payload, or remap them on the form's page in Customer.io. Names are case sensitive. |
| Phone attributes are missing | They're sent only when the visitor enters a phone number. Check that your form has an SMS field. |
| Fields show as blank | That property wasn't collected or isn't available for this visitor. Enrichment and IP-location fields won't be filled for every profile. |