# Integrating with Customer.io

Learn how to connect Emailable to Customer.io.

In this guide, we'll show you how to verify people's email addresses and unsubscribe from those that aren't deliverable.

## **Set up API Key**

To integrate Emailable with Customer.io, you'll need to create a Private API key. Head over to the API Page.

![Private API key from Emailable dashboard](https://cdn.sanity.io/images/6ukvxgr7/production/1c823582f7619741eec41a3989a120b4369ed758-1560x1492.png)

Once you've created your API key, you'll be redirected back to the API Page, and you should see a table that includes your newly created API key.

![Created API key for customer.io integration](https://cdn.sanity.io/images/6ukvxgr7/production/5a073e76260092546840daf650edfd439b1d360b-1788x271.png)

## **Set up a webhook in Customer.io**

In Customer.io, you'll create or edit an existing campaign. The webhook step will be part of the campaign's workflow.

1. Start by adding a webhook to your workflow.

![webhook on customer.io for resquest and response setup](https://cdn.sanity.io/images/6ukvxgr7/production/fe46697ad779d15bf3fbe8f36af0a18dc99711af-1917x985.png)

Now that you've created a webhook, click it, and the sidebar should open. 

Click the Add Request button.

2. Set up the Request

You should now see a section with three tabs. (Request, Response, and Preview)

![Request on customer.io](https://cdn.sanity.io/images/6ukvxgr7/production/46d11796ff59c71d82515019a77921ac8e04a046-3200x864.jpg)


``` 
Type: POST

URL: https://api.emailable.com/v1/verify?email={{customer.email}}&api_key=YOUR_API_KEY
```

Make sure to replace **YOUR_API_KEY** in the URL above with your API Key.

3. Set up the Response

Now, click the Response tab, then click the Set up an attribute button.

![Response Tab on customer.io](https://cdn.sanity.io/images/6ukvxgr7/production/8f4e307295a48342a033a3721a38878d0aa6eb3c-3200x2704.jpg)

For our use case, we decided to map the following response data to the following fields


``` 
emailable_state: {{response.state}}
emailable_reason: {{response.reason}}
emailable_free: {{response.free}}
unsubscribed: {% if response.state == 'deliverable' %}false{% else %}true{% endif %}
emailable_unsubscribed: {% if response.state == 'deliverable' %}false{% else %}true{% endif %}
```

You can review your attribute mappings and add any others you would like by reviewing the test response.

Click the "Send test..." button in the top-right corner.

![test on customer.io](https://cdn.sanity.io/images/6ukvxgr7/production/0a4c620de7349602648269868b362aaf55162204-2064x3200.jpg)

## **Conclusion**

You've now set up Customer.io webhooks to verify email addresses using Emailable.

People with undeliverable email addresses will be automatically unsubscribed.

![customer.io webhook campaign with emailable](https://cdn.sanity.io/images/6ukvxgr7/production/cab2f9157b1457d6be105c8866741741e7c6aec8-1760x1852.jpg)

For all email campaigns, you'll want to set this webhook as the first step in their workflows.
