Category: Actions

Create a Zendesk Ticket with Customer.io

If you don’t already have a Zendesk account, sign up here. To create tickets via the Zendesk API, you need:

  • An Agent role or higher
  • Password Access enabled under Settings – Channels – API:
  • Your Zendesk subdomain. This can be found in the URL when you open Zendesk. In our example, in our URL, https://customeriohelp.zendesk.com/agent/admin/overview, the subdomain is customeriohelp.
Create your campaign

Inside your Customer.io account, create a new campaign— it can be event triggered or segment triggered depending on what should trigger the Zendesk ticket creation.

In our example we’ll use the event account_cancelled with an event attribute filter “feedback exists” as a trigger for our campaign:

Add a webhook

Add a webhook action to your workflow, and give it a name.

We’ll call our webhook “Account cancellation: Feedback provided”

After adding the webhook, click Add Request.

Compose your webhook’s headers

In the composer, next to POST, you’ll add a URL that consists of your Zendesk login email and password followed by the ticket endpoint:

https://[YOUR-EMAIL-ADDRESS]:[YOUR-PASSWORD]@[YOUR-ZENDESK-SUBDOMAIN].zendesk.com/api/v2/tickets.json

Ours looks like this:

https://win@customer.io:BoogieAmi@customeriohelp.zendesk.com/api/v2/tickets.json

With that done, your composer should now look something like this:

Compose your webhook’s body

For our new ticket we’ll use this content:

Adapt it to your needs; only the comment is mandatory, the other fields are at your discretion. You can find more information here on what fields are available.

Send Request

When you’re ready to test, you can click “Send Request”. Customer.io will show you the response from the Zendesk API.

If you’re successful you’ll see a 201 Created Response.

Success!

In Zendesk you will see a ticket created.

We’re excited to hear how you end up using Zendesk with Customer.io’s Webhook Action. If you have any trouble, let us know! We’re happy to help.

Send Data to Zapier

If you don’t have a Zapier account, start by creating one over at Zapier.com.

Zapier is one of the most flexible integrations we and you might want to use it to do things like:

  • Add data to a google sheet
  • Follow a person on twitter when they enter the segment “Has twitter name”
  • Add a ticket in Jira when a user does the event “bug_reported”
  • Send new paid accounts an invitation to review your service on Trustpilot
Get started: create your webhook in Zapier

In your Zapier account, create a new Zap. Choose the “Webhooks” Trigger App and then select “Catch Hook.”

We don’t need to set any options, so click continue if you see that screen. Then copy and paste the Webhook URL.

Create your campaign in Customer.io

If you’re starting a new campaign, you can create one now.

Inside your Customer.io account, create your campaign— it can be event triggered or segment triggered.

Add and name your webhook

In Customer.io, add a new webhook action in the campaign’s workflow and give it a name.

You then need to customize it. To do so, click Add Request to enter the composer.

Customize your webhook

Next to POST, add in the API endpoint we want to send our request to. Paste in the URL you copied from Zapier. It should look something like:

https://hooks.zapier.com/hooks/catch/xxxxx/xxxxx

If you’re doing a segment triggered campaign, the easiest way to send a webhook to zapier is to just send the entire Customer object:

{% raw %}{ "customer": {{ customer | to_json }} }{% endraw %}

With an event triggered campaign, you can send over both the event object and customer object:

{% raw %}{ "event": {{ event | to_json }}, "customer": {{ customer | to_json }} }{% endraw %}
Send Request

When you’re ready to test, you can click Send Request. Customer.io will show you the response from the Zapier API.

If you’re successful, you’ll see a 200 OK. Then, in Zapier, you’ll also see a Test Successful response.

Then, create your action in Zapier!

Now that your data is flowing in to Zapier, you can complete the rest of their process and hook Customer.io data up to any one of their integrations.

We’re excited to hear how you end up using Zapier with Customer.io’s Webhook Action.

Create a Trello Card with Customer.io

If you don’t have a Trello account, you can create one here. Then, after you log in, retrieve your developer API key.

Get your token

You’ll also need a token. To get one, paste your own API key into the URL below: code

https://trello.com/1/authorize?expiration=never&scope=read,write,account&response_type=token&name=Server%20Token&key=YourAPIKeyHere
Allow access

Click the Allow button to give access to your boards and teams. If you’re successful, you’ll see a white page with the following content… blockquote You have granted access to your Trello information.
To complete the process, please give this token:

…and your token should be there!

Find the List ID

There is one more piece of data you need: the id of the list where you want to post your cards. To find this ID:

  1. Open the board that contains your chosen list.
  2. Add one card to that list (if one does not exist already).
  3. Open the card and copy the URL that you see in the address bar.
  4. It should be short URL that looks like https://trello.com/c/DcqBrqdx/1-target-card
  5. Take that URL and add “.json” to the end, like this: https://trello.com/c/DcqBrqdx/1-target-card.json
  6. Go to this URL. In the code, you will see a field called idList.
  7. Copy the idList:
Create your campaign

Inside your Customer.io account, create a new campaign (event triggered or segment triggered depending on what should trigger the Trello card creation.

In our example we’ll use the event FeedbackRequest with an attribute filter “Accepted is equal to true”.

Add a webhook action

Add a webhook action to your workflow, and give it a name. We’ll call our webhook “Contact customer”:

After adding the webhook, click Add Request.

Set your endpoint in the composer

Next to POST add the Trello endpoint, with your API key and token pasted into it:

https://api.trello.com/1/cards?key=YOUR-API-KEY&token=YOUR-TOKEN

Be careful not to add any extra spaces before or after this URL.

Customize your webhook body

For the body of our new card we’ll use this sample content:

idList needs to be replaced with the idList we retrieved from Trello. Only the due and idList attributes are mandatory. You can find more information about other attributes here.

Send Request

When you’re ready to test, you can click Send Request. Customer.io will show you the response from the Trello API.

If you’re successful you’ll see a 200 OK Response.

Success!

In Trello you will see this card created.

We’re excited to hear how you end up using Trello with Customer.io’s Webhook Action. If you have any trouble, let us know! We’re happy to help.

Create a Lead in Salesforce with Customer.io

Create a Lead in Salesforce with Customer.io

In this walkthrough, we’ll first show you how to configure Salesforce to enables its API and connect Customer.io as a Connected App. Then, we’ll show you how to create a lead in Salesforce with Customer.io.

Get Started Configuring Salesforce

Let’s make sure API access is enabled in Salesforce first. The easiest way to test this is by opening the “Developer Console” from the “Setup” menu and to open a resource.

Ensure API Access is Enabled

This will open the Developer Console in a new window. Navigate to “Open Resource” in the “File” menu.

If API access is enabled, you should see another window with the available resources. If API access is disabled, you’ll either see a message like “The REST API is not enabled for this Organization.” or “API_DISABLED_FOR_ORG”.

If your Salesforce API access is disabled, you’ll have to contact your Account Manager and have them enable it for you.

Set Up a Connected App

Navigate to the “Setup Home”. Go to the “Apps” under “Platform Tools” and create a new “Connected App”.

For the Connected App check the “Enable OAuth Settings” checkbox and select “Full Access” scope.

Once created, you’ll have access to the “Consumer Key” and “Consumer Secret” which will be used in the final request to get the access token.

Configure OAuth IP Restrictions

By default, IP restrictions are enforced—so you can either add “Trusted IP Range for OAuth Web server flow” or change the settings to disable IP restrictions.

In order to disable the IP restrictions, click the “Manage” button for the app and then click the “Edit” button. Next, set the IP relaxation setting to “Relax IP restrictions”.

Reset Security Token

The final piece of information needed is your security token. Navigate to your personal settings, then to “Reset My Security Token”, and click the “Reset Security Token” button. Your token will be emailed to you.

Retrieve Access Token

Now you can generate access tokens to authorize web requests to update Salesforce.

Replace the [variables] in the curl request below and make the request:

  curl -XPOST https://login.salesforce.com/services/oauth2/token \
  -d "grant_type=password&client_id=[ConsumerKey]&client_secret=[ConsumerSecret]&username=[LoginEmail]&password=[LoginPassword][SecurityToken]" \
  -H "X-PrettyPrint: 1"

This will return a response like:

  {
    "access_token" : "00D50000000NGi2!AQQAQH9ob.5uh.QjYSmJ71mTxya8ziK.Y_Z7q8kNsTFJoF0jJEJEBLKo_zBNKMFbHx253rzrjk84WGHl4.YdSaxLsIqO2iA9",
    "instance_url" : "https://na3.salesforce.com","id" : "https://login.salesforce.com/id/00D50000000NGi2EAG/00550000005pnXCAAY",
    "token_type" : "Bearer",
    "issued_at" : "1469540453130",
    "signature" : "9vlwhHvRx+8N2QVbpDxsneQGGW7mNkYU+FGjLPB7ykQ="
  }

We will be using the instance_url and the access_token for our web requests.

Create a Generate Lead in Salesforce Campaign

You can use either an event triggered or a segment triggered campaign depending on which best suits your use case. For this tutorial, we’ll use a segment triggered campaign with the default “Signed Up” segment.

Add A Webhook Action

On the workflow page select “Webhook” from the “Add Action” dropdown. We’ll call our webhook “Create Salesforce Lead”

Create Your Webhook URL

Next, click “Add Request” button on the webhook to configure its details.

In the composer view, we’ll set up the URL, authorization headers, and the request body to be able to generate leads in Salesforce. In this step, we’ll use the instance_url and the access_token from the Salesforce call we made earlier.

The url for the request will be:

[instance_url]/services/data/v37.0/sobjects/Lead/Email/{{customer.email}}?_HttpMethod=PATCH

A few points to note about the URL:

  • we use the instance_url from the Salesforce call as the base of our URL .
  • The {{customer.email}} is a Liquid tag, which automatically gets replaced with the email for the new customers flowing through the campaign.
  • We’re sending the query param _HttpMethod=PATCH so that the we will either create a new lead with the email provided or update the existing lead with the data provided.

So for our example, the URL looks like this:

https://na3.salesforce.com/services/data/v37.0/sobjects/Lead/Email/{{customer.email}}?_HttpMethod=PATCH
Add Authorization Header

Next, click “Add Header” and provide your access_token. The name of the header should be “Authorization” and the Value must be “Bearer [access_token]”.

Compose your webhook’s body

In order to create a lead in Salesforce, you’ll likely want to send details like name, email address, and custom data. For our example, we’ll send three attributes to Salesforce: first name, last name, and company name.

(Since we’re passing the email address in the URL, we don’t need to specify it in the body. Salesforce will automatically associate the email with the record.)

Send Test Request

If you have customers in your account that match the trigger, you can use one of them to preview the request body as well to send a test request to ensure they end up in Salesforce.

Use the “Send Request” button to make the call and create the lead on Salesforce. You will be prompted to confirm that you wish to send the the web request, after which you should get the 201 Created response from the API call.

Salesforce uses the email as an unique id, so that if you send a request for an existing user, you should get back a 204 No Content response, where the existing record would be updated with any changes.

Success!

Finally we can confirm that everything works correctly by looking up the lead in Salesforce.

Note! The Salesforce access tokens expire frequently, and therefore need to be updated. Otherwise, requests will fail due to lack of authorization.

  • You can set up a cron job to update the access token more frequently, enabling you to set the webhook campaign to “Send Automatically.”
  • If that’s not accessible to you, we recommend setting your campaign to “Queue Draft” and approve sends in bulk manually. When you see that drafts are failing due to unauthorized requests (you’ll see a 401 Unauthorized error message), you’ll have to update the access token for the webhook.

Also note: Salesforce limits the number of requests you can make in a 24-hour window. Exceeding it will cause all subsequent requests to fail. The limit is tied to number of account licenses.

Need a hand? Let us know We’re happy to help.

Send an NPS survey with Promoter.io and Customer.io

Login or create an free account on Promoter.io if you do not already have one.

Select your import method

Once created, you will be prompted to select a method to import contacts into Promoter.io.

Choose “Promoter API.

Name and set up your campaign

From here, you will need to work your way through the campaign setup and configuration wizard.

The first step is to name and set up your campaign.

Name and set up your list

Next, you’ll want to name and set up your list.

This is the list of contacts to which your NPS newsletter will be sent, and to which Customer.io will be sending data.

Choose or create your NPS template

Choose which survey template you’d like to use from Promoter.io, or create a new one. This is the template that will be used to send out your survey to the above list.

If you need to, you can send a test mail to yourself to see how the template works.

Configure delivery time and recurrence of NPS template

Choose when you’d like to send the newsletter, and whether or not there is a delay in sending, after the user is added to your list.

Get your API information

Once you’ve finished your setup, you will be presented with a page with all of your API integration information.

You’ll need your API key, endpoint, and campaign ID. The endpoint looks something like this:

https://app.promoter.io/api/contacts/survey/

While your API key will be at the very top of the page, a string of numbers and letters. You’ll need both when you’re setting up your webhook in Customer.io.

Create your Customer.io campaign

Then, in Customer.io, create your campaign and give it a name. Once you’ve done that, select your segment or event trigger.

Create your webhook

Now, in the workflow, we can set up our webhook action. Add your webhook, and give it a name.

Then, click Edit Request to get the details set up.

Configure your webhook’s headers

Next to POST, add your API endpoint that we mentioned earlier. Again, it should look something like:

https://app.promoter.io/api/contacts/survey/

Then, click ‘Add header’. Give it a name of ‘Authorization’ and a value of:

Token YOUR_API_KEY_HERE

Your API key can be found in your campaigns settings, in the step above. Our headers look something like this:

Configure your webhook’s body

The body of your webhook is what you’ll be adding to the list. In ours, we have the following:

This means that, to our Actions Test List we defined earlier, we will be adding a user with an email of test@email.com, with the attributes “Bronze” for their Plan, and “Ice Cream” as their favourite food. After you confirm your test works you’ll want to replace your test email address TEST@EMAIL.COM with the {{customer.email}} liquid tag.

The only mandatory fields here are “email” and “campaign.” This is where you need your campaign ID from earlier; it should be a five-digit number.

Compose and customize the body however you need to. For a more comprehensive list of attributes, you can view Promoter’s API Docs.

Send Request

When you’re ready to test, you can click “Send Request”. Customer.io will show you the response from the Promoter API.

If you’re successful, you’ll see a 201 Created Response.

Success!

You can now ensure that data and actions are passing as expected between Customer.io and Promoter.io:

In the Promoter.io interface, click on Contact Lists in the top nav. On this page, you’ll see the test list; click into it to see your contact added:

Your survey should they go out however you’ve configured it within Promoter, with whichever template and delay you’ve chosen!

We’re excited to hear how you end up using Promoter.io with Customer.io’s Webhook Action. If you have any trouble, let us know! We’re happy to help.

Start mailing Lob postcards with Customer.io

Get your Lob API key

If you don’t have a Lob account, start by creating one over at Lob.com. In your Lob account, you’ll want the API Key from your account. We recommend starting with your “Test API Key” from your settings.

Create your campaign

Create a campaign in Customer.io where you want to add the webhook action. For our example, we’re using a segment triggered campaign with the segment “Paid 3 times” as our trigger.

Add your webhook action to the workflow

Add a new webhook action in the campaign’s workflow, and give it a name. Then click Add Request.

You’ll then be brought to the Webhook composer.

Add your webhook headers

Next to POST, add in the API key and the postcard API endpoint in this format:https://[API-KEY]:@api.lob.com/v1/postcards, so the API key followed by a colon : and an @ sign.

Note: If you’re trying to send a letter or a check, more endpoints are in the Lob documentation.

Your headers should look something like:

Customize your postcard

Copy and paste this example code in to the content area for your webhook.

You’ll want to adjust the liquid for mailing addresses to match your custom attribute names in Customer.io.

For details on customizing the front or back of the postcard, take a look at Lob’s documentation.

When you’re done, you’ll have a finished webhook that looks something like:

Send Request

When you’re ready to test, you can click Send Request. Customer.io will show you the response from the Lob API.

If you’re successful, you’ll see a 200 OK.

Success!

In Lob, you should now see your postcard successfully created.

We’re excited to hear how you end up using Lob with Customer.io’s Webhook Action. If you have any trouble, let us know! We’re happy to help.

Start sending data with IFTTT

If you don’t have an IFTTT account, start by creating one over at IFTTT.com.

IFTTT is a great option for connecting to devices, web apps, or services for things like:

  • Turn on a light in your office when you get a new “plan_enterprise” user
  • Create a calendar event to follow up users who enter the “Signed Up” segment
  • Email to your success team when a user triggers “payment_failed”
Create your recipe

In your IFTTT account, create a new recipe. Select the “Maker” channel and select “Receive a web request”.

Give your event a descriptive title, like user_upgraded_plan.

Choose a service to connect to

Pick which of the 300+ services should be activated by this event.

Format your data and create your action

If your recipe allows you to pass along data, take this opportunity to configure it.

Once you’re done, you can create your action and your recipe.

Create your campaign in Customer.io

If you’re starting a new campaign, you can create one now.

Inside your Customer.io account, create your campaign— it can be event triggered or segment triggered.

Add and name your webhook

In Customer.io, add a new webhook action in the campaign’s workflow and give it a name.

You then need to customize it. To do so, click Add Request to enter the composer.

Find your key, and customize webhook action

Next to POST, add in the API endpoint we want to send our request to. You can find your Maker request url and key here, under “How to Trigger Events”

The key should look something like

https://maker.ifttt.com/trigger/{event}/with/key/XXXXXXXXXXXXXX

Replace {event} with the event name you picked earlier.

Your webhook composer should look something like this:

IFTTT allows you to send up to 3 custom data values along with your request which you can customize with liquid variables.

In the body of your request you could add something like:

Send Request

When you’re ready to test, you can click Send Request. Customer.io will show you the response from the IFTTT API.

If you’re successful, you’ll see a 200 OK. If your recipe was configured correctly, you should also have triggered it to complete!

Create a Help Scout conversation with Customer.io

If you don’t have a Help Scout account, you can create one here.

Get your Help Scout API key
  • Go to Your Profile (top right corner).
  • Select API Keys.
  • Click Generate an API Key.
  • Add a label to easily recognize the API key used inside Customer.io.

Please be aware that free plans don’t allow API access, and only owners and administrators are able to create API keys.

Get your Mailbox ID:
  • Open the mailbox where you want to create your conversations.
  • Go to Edit Mailbox (bottom left of the screen):
  • Copy the mailbox id from the URL. It will be something like:
https://secure.helpscout.net/settings/mailbox/[MAILBOX-ID]/
Create your campaign

Inside your Customer.io account, create a new campaign (event triggered or segment triggered depending on what should trigger the creation of a new conversation in Help Scout. In our example we’ll use the segment “Low NPS Rating” to target customers dissatisfied with our service.

Add a webhook action

Add a webhook action to your workflow, and give it a name. We’ll call our webhook “Low NPS Rating.”

After adding the webhook, click Add Request.

Compose your webhook

Next to POST add the Help Scout endpoint in this format:

https://[API-KEY]: @api.helpscout.net/v1/conversations.json

The result should look like:

https://7f7f8766b8a098b696c40a0c0e9034xXxXxXxXxX:X@api.helpscout.net/v1/conversations.json

At this point, you should see something like this:

Customize your webhook body

Grab the sample JSON content from https://gist.github.com/LiviaSarban/2e0b200f85926dc13f8e6922046c52e9.

Replace MAILBOX-ID with your own and adapt any attributes to your own data.

customer, subject, mailbox, and threads are mandatory fields. The rest are optional. You can read more about the options here: http://developer.helpscout.net/help-desk-api/conversations/create/

Our webhook body now looks something like this:

Send Request

Press Send Request to send a test webhook to your Help Scout mailbox.

If everything went well, you should see a 201 Created result.

Success!

Our new conversation was created in Help Scout!

Send an NPS survey using Delighted

If you don’t already have an account, you can sign up at https://delighted.com/.

Get your API Key

To send NPS surveys via API, you will need your API key. It can be found in your account under Settings > API. Only admins can view the API key for your account, so if you’re not the admin, reach out to the person in charge with the Delighted account in your company.

Create a new campaign

Inside your Customer.io account, create a new campaign— event triggered or segment triggered depending on what should trigger the Delighted NPS survey sending.

In our example we’ll use the “Upgraded” trigger segment and a 7 day delay.

Customize your campaign

We start by adding a delay to your Workflow to make sure our emails go out 7 days after a customer upgraded.

Also, because we’re looking to get higher open rates, we only want to send emails when our customers are likely to still be at work – Monday to Friday between 7 a.m. and 7 p.m. EST time. We achieve this by adding a time window:

Add your webhook action

Now that we set the stage, we’re ready to add the webhook action. We’ll call our webhook “Upgraded: 7 days survey.”

After adding the webhook, click Add Request.

Customize your webhook headers

Next to POST add your Delighted API key followed by the People endpoint. The format needs to be:

https://[API-key]@api.delighted.com/v1/people.json

For example:

https://CMj7SuKdy4w0oVdAqXsE5hxXxXxXxXxX@api.delighted.com/v1/people.json
Customize your webhook body

For our survey we’ll use the content from

Customize the fields however you like; only the email is mandatory. The others are at your discretion, and you can find more information about them in the Delighted API docs.

At this point, your webhook should look like this:

Send Request

When you’re ready to test, you can click Send Request. Customer.io will show you the response from the Delighted API.

If you’re successful you’ll see a 200 OK Response.

Success!

You will see the surveys sent in your Delighted account under People:

Our survey (sent in German because that was the language we chose) looks like this:

We’re excited to hear how you end up using Delighted with Customer.io’s Webhook Action. If you have any trouble, let us know! We’re happy to help.

Send Request

Create a Lead in Close.io

Close.io is a streamlined sales platform that helps you close more deals. With built-in calling and automatic email tracking, you can focus on selling rather than data entry. In our example, we’re going to show you how to send leads from Customer.io into Close.io, using our segment triggers.

If you don’t already have an account, you can create one at Close.io.

At any point, you can read all about adding a lead to Close.io via their API. Their docs include details on custom fields, give you example data, and more.

Get your Close.io API key

Once you have a Close.io account, go to your settings page and then click Your API Keys.

Once there, click Generate New API Key.

Create your campaign

The simplest case is to push a lead into Close.io for every signup that enters Customer.io. For your trigger, you can simply use the “Signed Up” segment that comes by default when setting up Customer.io, but you can create more sophisticated behaviors by using Customer.io segments.

You’ll want to use a segment triggered campaign to ensure that the campaign is entered once per profile. This will prevent duplicate leads from being generated (which could happen with an event triggered campaign).

Add your webhook action to the workflow

Click “Webhook” to add a new webhook action in the campaign’s workflow. We’ll call our webhook “Send a lead to Close.io”.

Create your webhook

Next, click “Add Request” to configure the details of your webhook.

To fill in the request URL, you’ll use your API Key as the username. For example, if your API Key is abcdef0123456789, your URL will look like this:

https://abcdef0123456789@app.close.io/api/v1/lead/
Compose your webhook’s body

Generally, a lead in Close.io will map to a profile in Customer.io. You’ll like store a subset of the data contained within a user profile attribute in Customer.io.

In order to create a lead in Close.io, you’ll likely want to send details like name, URL, contacts, and possibly custom data if you’ve created custom fields in Close.io. Below is a JSON example showing an example. Note: name in Close.io refers to the name of the lead (i.e. the company), not the contact name.

Using Liquid, we’ll insert the values from Customer.io into the required JSON format to add a lead to Close.io. If some values may not exist in Customer.io, but are required in Close.io, use fallbacks to provide a value.

Using the Composer Preview pane, verify that the JSON data is formatted correctly. Note: you can use a tool like JSON Lint to help find errors in your JSON.

At this point, your webhook composer should look something like this:

Send test request

Test out the mapping of your data into Close.io to ensure that the required fields and formatting work as expected.

Use the “Send Request” button to send your previewed request to Close.io. A 200 OK message will confirm that the request was received.

Success!

We’re excited to hear how you end up using Slack with Customer.io’s Webhook Action. If you have any trouble, let us know! We’re happy to help.

Once the campaign action is turned from Queue Draft to Send Automatically, leads will flow into Close.io based on the trigger conditions of your campaign. You’re all done!