Customer.io

customer.io-poplar

Before integrating and sending tests with Customer.io, make sure you've completed the following:

  • Create a campaign in Poplar
  • Upload creative (can be a placeholder creative for testing purposes - Poplar Creative Templates)
  • Locate both your Production Access Token and Test Access Token on the API page of your Poplar Account

For the webhook request to hit our API and be accepted, there must be an active campaignwithcreative uploaded - otherwise an <mark>400</mark> error will be sent back.

1.Log in to customer.io and click the Campaign tab on the left. You'll want to either Create a new campaign or edit an existing campaign workflow.

2.If creating a new campaign, give a name for your campaign, then click Create Campaign

3.On the Trigger Step, set the triggering event criteria, i.e. a user makes a purchase or abandons cart etc... Then when ready click Next

4.On the Workflow Step, you'll want to drag a new Webhook to your workflow.

customer.io-1

5. Click the newly added webhook to then name it and add content.

customerio-2

6. Set the URL to: https://api.heypoplar.com/v1/mailing/

7. Log into Poplar and setup a new test API Key for Customer.io. You can get the key at https://app.heypoplar.com/credentials. Copy the key and head back to the webhook configuration in customer.io  

We strongly recommend you use a test API key to start. Once your workflow is set up successfully and running in test mode, go back into the webhook and swap it out for a production API key to begin mailing.

8.Add a HTTP Header and configure an Authorization key and set the Bearer <Your API Key> (make sure to also delete the <>)

customerio-3

9.Configure the webhook contents. If you're doing address enrichment you just need to pass the email and any other variable data. If mailing existing customer addresses, you'll pass in the full address. Note the double brackets surrounding the variable data being passed.

For an email append: the customer attribute names you have in your account may differ and need to be modified.

{
  "recipient": {
    "email": "{{customer.email}}"
  },
  "campaign_id": "******-REPLACE WITH YOUR CAMPAIGN ID-******-****"
}
For a full address mailing:
{
  "recipient": {
    "full_name" : "{{customer.full_name}}",
    "address_1": "{{customer.address_1}}",
    "address_2": "{{customer.address_2}}",
    "city": "{{customer.city}}",
    "state": "{{customer.state}}",
    "postal_code": "{{customer.postal_code}}"
  },
  "campaign_id": "***-REPLACE WITH YOUR CAMPAIGN ID-***"
}
	

Key Value
campaign_id copy from the right side of the campaign page on Poplar
full_name Optional, you can also replace with a fixed string like 'Current Resident' for use on the address block
first_name When using first & last name instead of full name in your webhook, you must use BOTH or it will error out.
last_name
address_1
address_2
city
state
postal_code
email

You can also add merge tags with your own variable data at the end. When using first & last name options instead of full name you need to include both or it will error.

10. Test your webhook by sending a test, then checking the history tab of the campaign in poplar to see if it appeared.

11. We recommend leaving the webhook live with your test key for a period of time to get a sense for your volume. Once it looks like it's working well, go back in and replace the API key with a production key to begin mailing.

Exceptions/Troubleshooting

You may see an exception when you don't have a name or address_2 or other metadata you are referencing on every recipient record. It's easy to solve this using an if statement in the webhook.

{% if customer.address_2 != blank %}
    {{ customer.address_2 }}
{% else %}
{% endif %}