This preview of pull request 1639 is meant for internal use only.

Zendesk Destination

Zendesk quick info

Zendesk accepts Identify, and Group calls. If you reference it in the Integrations object, call it “Zendesk”.

Zendesk accepts cloud-mode data from all Segment source types. It does not offer device-mode connections.

Zendesk is a premier, cloud-based customer service application. It was designed with one purpose in mind: to improve communication between a company and its customers. Their products allow businesses to be more reliable, flexible, and scalable. They help improve communication and make sense of massive amounts of data. Above all, they work together to build the best experience for your customers.

This document was last updated on April 30, 2018. If you notice any gaps, outdated information or simply want to leave some feedback to help us improve our documentation, let us know!

Getting Started

Before you start, make sure Zendesk supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.

Web Mobile Server
📱 Device-mode ⬜️ ⬜️ ⬜️
☁️ Cloud-mode
  1. From the Segment web app, click Catalog.
  2. Search for “Zendesk” in the Catalog, select it, and choose which of your sources to connect the destination to.
  3. There are two ways to authenticate your Zendesk account with Segment:
    • Use the standard email and password you use to Sign In to your Zendesk account. In the Zendesk settings, add your email in the Email setting and your password in the Password setting.
    • Use Zendesk OAuth with a unique token. Get the corresponding token from your Zendesk account: Settings > Channels > API and under the Settings Tab choose the corresponding token from the “Active API Tokens” list. In the Zendesk settings, add your email/token in the Email setting (i.e. peter@intech.com/token - use the actual word token in your email address) and add the actual token in the Password setting.
  4. Add your Zendesk subdomain in the Subdomain setting (not including .zendesk.com).

Identify

If you’re not familiar with the Segment Specs, take a look to understand what the Identify method does. An example call would look like:

analytics.identify("97980cfea0067", {
  name: "Peter Gibbons",
  email: "peter@example.com",
  plan: "premium",
  logins: 5
});

When you call identify we will insert or update a user record in Zendesk. We’ll use the user email in traits.email to match user records in Zendesk. If there are multiple users matching the email, then no updates are submitted. Note that you must provide a trait for either name or first_name and last_name in order for the identify call to send to Zendesk. If you provide a name, we will parse this into the first_name and last_name fields.

Here’s an example:

{
  "action": "identify",
  "userId": "12345",
  "traits": {
    "name": "Pikachu",
    "email": "pikachu@pakemon.com",
    "timezone": "America/Los_Angeles",
    "organizationId": 6789,
    "phone": "763-555-2342"
  }
}

By default, Users in Zendesk have many standard attributes associated with a single User record. Segment, at this time, is mapping to a subset of these. If you attempt to send data to a Zendesk attribute that we have not yet mapped, it will create a custom field for this (it will not update the existing attribute).

Here are the Zendesk User Attributes Segment maps to and their syntax.

Segment Field Name Zendesk Field Name
email email
name name
organizationId organization_id
timezone time_zone
phone phone
userId user_id
userId external_id

Note on Name: If name is provided, Segment will parse firstName and lastName from this, or you can send firstName and lastNameseparately and they will be concatenated to name.

Removing Users from a Zendesk Organization Membership on Segment Identify

To remove a user from an organization, navigate to your Zendesk destination settings and click Enable Removing Users from Organizations . When this setting is enabled, Segment detects when you pass an identify events with traits.company.id where traits.company.remove: true, and then sends a request to the Zenedesk API to remove the user from the organization. If you enable the setting in your Zendesk destination settings but do not pass the correct trait values, Segment defaults to the standard identify behavior, which creates or updates a user.

Here’s an example:

{
  "action": "identify",
  "userId": "12345",
  "traits": {
    "name": "Pikachu",
    "email": "pikachu@pokemon.com",
    "timezone": "America/Los_Angeles",
    "organizationId": 6789,
    "phone": "763-555-2342",
    "company": {
      "id": "6789",
      "remove": true
    }
  }
}

Note: When a request is made, Zendesk schedules a job to unassign all working tickets currently assigned to the user and organization combination. The organization_id of the unassigned tickets is set to null.

Zendesk Verification Email at User Creation

To limit identified users from receiving a verification email from Zendesk, simply enable the “Create Users as Verified” option in the Zendesk destination settings. We will send verified as either true or false for each request based on this setting (you cannot overwrite this on a per-request basis).

Zendesk Custom User Fields

You may map to custom user fields within Zendesk by passing your custom field key-value pair as a trait in the Identify call. When passing traits within the identify event, Segment will first try and map the trait to a known, existing field in Zendesk - either the canned standard fields described above or to a custom field (user_fields). We format the field name from either camelCaseFormat or snake_case_format into snake_case_format. If you’re finding that your custom fields are not populating in Zendesk as you would expect check the name formatting with this in mind.

Track

If you’re not familiar with the Segment Specs, take a look to understand what the Track method does. An example call would look like:

analytics.track('Article Completed', {
  title: 'How to Create a Tracking Plan',
  course: 'Intro to Analytics',
});

Important: You must have a Zendesk Sunshine plan to make track calls.

When you make a Track call, Segment sends data about the user’s activity to Zendesk.

We will only send track events when the following two conditions are met:

  1. The call is listed in the “Events” setting.
  2. A userId is included.
    • Note: If the userId doesn’t match any existing users in Zendesk, we will return an error.

Mapping Users to an Email: To map a Segment track event to a Zendesk Sunshine event by email, add the user’s email address in the Track call as properties.email. This allows Zendesk to tie the event to the user. If there is no properties.email, Segment sends the userId as external_id. If the email is provided in the track call, a javascript call may look like the example below.

analytics.track('Article Completed', {
  title: 'How to Create a Tracking Plan',
  course: 'Intro to Analytics',
  properties: {
    email : 'user@example.com',
  }
});

Group

If you’re not familiar with the Segment Specs, take a look to understand what the Group method does. An example call would look like:

analytics.group("0e8c78ea9d97a7b8185e8632", {
  name: "Initech",
  industry: "Technology",
  employees: 329,
  plan: "enterprise",
  "total billed": 830
});

Important: To make group calls, you must be an Administrator in Zendesk.

When you call group we will insert or update an organization in Zendesk. We’ll use the groupId you include in the call to match organization records in Zendesk. If there are multiple organizations matching the name, then no updates are submitted.

Here’s an example:

{
  "action": "group",
  "groupId": "908172409",
  "userId": "6789",
  "traits": {
    "name": "LA Lakers",
    "url": "https://lakers.com",
    "deleted": false
  }
}

Every time you call group, we will also link the organization to the user making the request.

By default, Organizations in Zendesk have many standard attributes associated with a single Organization record. Segment, at this time, is mapping to a subset of these. If you attempt to send data to a Zendesk attribute that we have not yet mapped, it will create a custom field for this (it will not update the existing attribute).

Here are the Zendesk Organization Attributes Segment maps to and their syntax.

Segment Field Name Zendesk Field Name
name name
domainNames       domain_names
tags          tags        
groupId external_id
url url
deleted deleted

Zendesk Custom Organization Fields

You may map to custom organization fields within Zendesk by passing your custom field key-value pair as a trait in the Group call. When passing traits within the group event, Segment will first try and map the trait to a known, existing field in Zendesk - either the canned standard fields described above or to a custom field (organization_fields). We format the field name from either camelCaseFormat or snake_case_format into snake_case_format. If you’re finding that your custom fields are not populating in Zendesk as you would expect check the name formatting with this in mind.

Personas

You can send computed traits and audiences generated using Segment Personas to this destination as a user property. To learn more about Personas, contact us for a demo.

For user-property destinations, an identify call is sent to the destination for each user being added and removed. The property name is the snake_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Personas sends an Identify call with the property order_completed_last_30days: true. When the user no longer satisfies this condition (for example, it’s been more than 30 days since their last order), Personas sets that value to false.

When you first create an audience, Personas sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

Create Users as Verified

Passes the verify flag set to true on each user upsertion, which will mean customers needn’t confirm their email upon account creation. See here for more information.

Enable Removing Users from Organizations

Enable this setting if you would like to remove users organization memberships on .identify() calls when you pass a company.id trait and the company.remove trait is set to true.

Events

Introduce the event names you want to send to Zendesk.

A Zendesk Support account with a Sunshine plan is required to use the Sunshine Events API. Sunshine plans are available on the Support Enterprise or Suite Enterprise plans and above. For more details, see Zendesk Sunshine

Send Group Calls Without UserId

Enable this setting if you want to send .group() events without a userId field present in the payload. When this setting is enabled and no userId is present the integration will only create or update and organization on .group(). To do so your Zendesk authorization must be configured as an “Agent”. ** NOTE:** If you would like to link users to organizations on group calls do not enable this setting.

Subdomain

Your Zendesk subdomain, not including .zendesk.com. Please do not directly edit this setting. To update your subdomain, please re-authenticate using the oAuth process.

This page was last modified: 11 May 2021



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account