# Zendesk Export Integration

Zendesk® Sunshine's modern cloud based CRM platform is used to identify customer needs and trends. You can use the Zendesk Export Integration connector to export Events data to Zendesk Sunshine.

## Prerequisites

- Basic knowledge of Treasure Data
- Zendesk Sunshine account


## Limitations

The result output schema must match the required columns (name and data type) with a target event.

`profile_identifier` can be set to a maximum of 20 columns (1 → 20 in a continuously ascending order).

| Action | Target | Column required | Column requires at least 1 | Column optional | Note |
|  --- | --- | --- | --- | --- | --- |
| Create | Events for profiles | profile_source(String), profile_type(String), event_source(String), event_type(String), event_properties(JSON String) | profile_identifier_1 to profile_identifier_20 (String) | profile_name, profile_created_at, profile_attributes, event_description, event_created_at, event_received_at | See "Identifier columns" below for format and limits. |
| Create | Events for a profile ID | profile_id(String), event_source(String), event_type(String), event_properties(JSON String) |  | event_description, event_created_at, event_received_at | See "Events for a profile ID" details. |
| Create | Events for a user ID | user_id(String), profile_source(String), profile_type(String), event_source(String), event_type(String), event_properties(JSON String) | profile_identifier_1 to profile_identifier_20 (String) | profile_name, profile_created_at, profile_attributes, event_description, event_created_at, event_received_at | See "Identifier columns" below for format and limits. |


## Column details

### Events for profiles

**Required columns**

- `profile_source (String)`
- `profile_type (String)`
- `event_source (String)`
- `event_type (String)`
- `event_properties (JSON String)` – provide serialized key-value pairs for the event payload.


**Identifiers (at least one)**

- Up to 20 columns named `profile_identifier_1` through `profile_identifier_20`.
- Each value must follow the `type,value` pattern (for example, `email,example@gmail.com`).


**Optional columns**

- `profile_name`
- `profile_created_at`
- `profile_attributes`
- `event_description`
- `event_created_at`
- `event_received_at`


### Events for a profile ID

**Required columns**

- `profile_id (String)`
- `event_source (String)`
- `event_type (String)`
- `event_properties (JSON String)`


**Optional columns**

- `event_description`
- `event_created_at`
- `event_received_at`


### Events for a user ID

**Required columns**

- `user_id (String)`
- `profile_source (String)`
- `profile_type (String)`
- `event_source (String)`
- `event_type (String)`
- `event_properties (JSON String)`


**Identifiers (at least one)**

- Same `profile_identifier_1` through `profile_identifier_20` columns and `type,value` rule as listed above.


**Optional columns**

- `profile_name`
- `profile_created_at`
- `profile_attributes`
- `event_description`
- `event_created_at`
- `event_received_at`


## Zendesk Sunshine Limitations

### Rate Limit

The API enforces rate limiting on standard create endpoints. Limits include requests made from the Zendesk Apps framework. The rate limits for each plan type are:

|  | Sunshine Lite | Sunshine Professional | Sunshine Enterprise |
|  --- | --- | --- | --- |
| Custom objects | 500 requests per minute | 750 requests per minute | 1,000 requests per minute |
| Profiles | Not included | 250 requests per minute | 500 requests per minute |
| Events | Not included | 250 requests per minute | 500 requests per minute |


### Profiles Limit

The following table shows profiles hard limits. Availability and limits can vary according to Sunshine plan type.

| Category | Limit |
|  --- | --- |
| Profiles | 30,000,000 |
| Profile sources | 50 |
| Profile types | 2500 |
| Identifiers per profile | 20 |
| Profile source character length | 40 |
| Profile type character length | 40 |
| Identifier source character length | 60 |
| Identifier type character length | 60 |


### Event Limit

The following table shows events hard limits. Availability and limits can vary according to Sunshine plan type.

| Category | Limit |
|  --- | --- |
| Event sources | 50 |
| Event types | 2500 |
| Event source character length | 40 |
| Event type character length | 40 |


## Create a Zendesk OAuth Client

Follow these steps only if you plan to authenticate with **OAuth Client Credentials**. Client Credentials suits unattended, scheduled exports because no person has to authorize the connection at run time. If a person can authorize the connection interactively, use OAuth instead.

API tokens are being deprecated
Zendesk blocks the creation of new API tokens after 2026-10-27 and deactivates all remaining API tokens on 2027-04-30. Use **OAuth Client Credentials** for new scheduled exports. See the Zendesk announcement, [Announcing the removal of API tokens as an authentication method for API requests](https://support.zendesk.com/hc/en-us/articles/10851263566234-Announcing-the-removal-of-API-tokens-as-an-authentication-method-for-API-requests).

1. Sign in to Zendesk as an administrator with a durable service account. Zendesk attributes every action the integration performs to the user who created the OAuth client, so avoid using a personal account that might be deactivated.
2. Go to **Admin Center** > **Apps and integrations** > **APIs** > **OAuth clients**.
3. Click **Add OAuth client**.
4. Enter a **Client Name**, a **Unique Identifier** (this becomes your **Client ID**), and a **Redirect URL**. The redirect URL is not used by the Client Credentials grant, but Zendesk requires a value.
5. Click **Save**, then confirm. Zendesk generates the **Secret**.
6. Copy the **Secret** now and store it securely. Zendesk displays it only once, and you cannot retrieve it later — you can only generate a new one.
7. Make sure the OAuth client is allowed the scopes the integration requests:
  - Import: `read`
  - Export: `users:write`
Allow both `read` and `users:write` if the same OAuth client is used for import and export.


You now have the **Client ID** (the unique identifier) and **Client Secret** you need to configure the connection in Treasure AI.

## Use the Treasure Console to Create Your Connection

### Create a New Connection

In Treasure Data, you must create and configure the data connection to be used during export prior to running your query. As part of the data connection, you provide authentication to access the integration.

1. Open the Treasure Console.
2. Navigate to Integrations Hub > Catalog.
3. Search and select Zendesk.


![](/assets/image2020-11-20_14-59-51.7917e6aba4f3c541257c8b108035f65cccd06616bee8cacf4f1168cca58471a1.b016e98c.png)

1. Click **Create.** You are creating an authenticated connection. The following dialog opens.


![](/assets/image2020-11-20_15-0-3.0aefdf7dd4c60ce220bb74a33d222c8e4b1bff7b13360de17d55352468d0cf0d.b016e98c.png)

1. To export event data with basic, token, or OAuth authentication, type the login URL for Zendesk. For example: [https://{your_domain}.zendesk.com](https://boxycharm1597678338.zendesk.com). **OAuth Client Credentials** does not use this field.
2. There are different options for **Auth method**: basic, token, OAuth, and OAuth Client Credentials.
3. Optionally, for basic authentication, type values for username and password.
4. Optionally, for token, type values for username and token.
5. Optionally, for OAuth, type values for OAuth Access Token.
6. Optionally, for OAuth Client Credentials, type values for **Zendesk subdomain**, **Client ID**, and **Client Secret**. The subdomain is only the subdomain part of your Zendesk URL, for example `example` for `https://example.zendesk.com`. See [Create a Zendesk OAuth Client](#create-a-zendesk-oauth-client).
7. Select **Continue**.
8. Name your new Zendesk connection.
9. Select **Done**.


![](/assets/image2020-11-20_15-0-20.6d1a59ebc5c90a71d6773a4aa932bb3d21e98e7b1581e3aa65b29d29b568df12.b016e98c.png)

### Configure Export Results in Your Data Connection

Create or reuse a query.

Sometimes you need to define the column mapping in the query.

1. Open the Treasure Console.
2. Navigate to **Data Workbench** > **Queries**.
3. Select the query that you plan to use to export data. Each type of resource **requires specific columns** and **exact column names (case sensitive)** and **data types**. Code examples that can be used to export data:


Events for profiles

```sql
SELECT 
 profile_source, 
 profile_type, 
 profile_identifier_1,
 event_source, 
 event_type, 
 event_properties
FROM 
  your_table;
```

Events for profile ID

```sql
SELECT p
 profile_id, 
 event_source, 
 event_type, 
 event_properties
FROM 
 your_table;
```

Events for user id

```sql
SELECT 
 user_id, 
 profile_source, 
 profile_type, 
 profile_identifier_1,
 event_source, 
 event_type, 
 event_properties
FROM 
 your_table;
```

1. Select **Export Results** located at the top of your query editor.  The Choose Integration dialog opens. You have two options when selecting a connection to export the results, using an existing connection or creating a new one. These instructions assume you are selecting an existing connection.
2. Type the connection name in the search box to filter.
3. Select your connection.
4. Select one of the following:


![](/assets/image2020-11-20_15-3-54.557766e29ba2c08f1aeef9f046973f09c0f1c596465b72cd60e1098b7822e2cb.b016e98c.png)

1. Optionally, select Skip invalid records.
2. Select Done.


### (Optional) Schedule Query Export Jobs

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.

Treasure Data's scheduler feature supports periodic query execution to achieve high availability.

When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored.

For example, if the cron schedule is `'0 0 1 * 1'`, then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed.

#### Scheduling your Job Using Treasure Console

1. Navigate to **Data Workbench > Queries**
2. Create a new query or select an existing query.
3. Next to **Schedule**, select None.
![](/assets/image2021-1-15_17-28-51.f1b242f6ecc7666a0097fdf37edd1682786ec11ef80eff68c66f091bc405c371.0f87d8d4.png)
4. In the drop-down, select one of the following schedule options:
![](/assets/image2021-1-15_17-29-47.45289a1c99256f125f4d887e501e204ed61f02223fde0927af5f425a89ace0c0.0f87d8d4.png)
| Drop-down Value | Description |
|  --- | --- |
| Custom cron... | Review [Custom cron... details](#custom-cron-details). |
| @daily (midnight) | Run once a day at midnight (00:00 am) in the specified time zone. |
| @hourly (:00) | Run every hour at 00 minutes. |
| None | No schedule. |


#### Custom cron... Details

![](/assets/image2021-1-15_17-30-23.0f94a8aa5f75ea03e3fec0c25b0640cd59ee48d1804a83701e5f2372deae466c.0f87d8d4.png)

| **Cron Value** | **Description** |
|  --- | --- |
| `0 * * * *` | Run once an hour. |
| `0 0 * * *` | Run once a day at midnight. |
| `0 0 1 * *` | Run once a month at midnight on the morning of the first day of the month. |
| "" | Create a job that has no scheduled run time. |


```
 *    *    *    *    *
 -    -    -    -    -
 |    |    |    |    |
 |    |    |    |    +----- day of week (0 - 6) (Sunday=0)
 |    |    |    +---------- month (1 - 12)
 |    |    +--------------- day of month (1 - 31)
 |    +-------------------- hour (0 - 23)
 +------------------------- min (0 - 59)
```

The following named entries can be used:

- Day of Week: sun, mon, tue, wed, thu, fri, sat.
- Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.


A single space is required between each field. The values for each field can be composed of:

div
| Field Value  | Example  | Example Description  |
|  --- | --- | --- |
| A single value, within the limits displayed above for each field. |  |  |
| A wildcard `'*'` to indicate no restriction based on the field. | `'0 0 1 * *'` | Configures the schedule to run at midnight (00:00) on the first day of each month. |
| A range `'2-5'`, indicating the range of accepted values for the field. | `'0 0 1-10 * *'` | Configures the schedule to run at midnight (00:00) on the first 10 days of each month. |
| A list of comma-separated values `'2,3,4,5'`, indicating the list of accepted values for the field. | `'0 0 1,11,21 * *'` | Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month. |
| A periodicity indicator `'*/5'` to express how often based on the field's valid range of values a schedule is allowed to run. | `'30 */2 1 * *'` | Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. `'0 0 */5 * *'` configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month. |
| A comma-separated list of any of the above except the `'*'` wildcard is also supported `'2,*/5,8-10'`. | `'0 0 5,*/10,25 * *'` | Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month. |


1. (Optional) You can delay the start time of a query by enabling the Delay execution.


### Execute the Query

Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination.

Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.

(Optional) You can delay the start time of a query by enabling the Delay execution.

## Activate a Segment in Audience Studio

You can also send segment data to the target platform by creating an activation in the Audience Studio.

1. Navigate to **Audience Studio**.
2. Select a parent segment.
3. Open the target segment, right-mouse click, and then select **Create Activation.**
4. In the **Details** panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters.
5. Customize the activation output in the **Output Mapping** panel.


![](/assets/ouput.b2c7f1d909c4f98ed10f5300df858a4b19f71a3b0834df952f5fb24018a5ea78.8ebdf569.png)

- Attribute Columns
  - Select **Export All Columns** to export all columns without making any changes.
  - Select **+ Add Columns** to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select **+ Add Columns**to add new columns for your activation output.
- String Builder
  - **+ Add string** to create strings for export. Select from the following values:
    - String: Choose any value; use text to create a custom value.
    - Timestamp: The date and time of the export.
    - Segment Id: The segment ID number.
    - Segment Name: The segment name.
    - Audience Id: The parent segment number.


1. Set a **Schedule**.


![](/assets/snippet-output-connector-on-audience-studio-2024-08-28.a99525173709da1eb537f839019fa7876ffae95045154c8f2941b030022f792c.8ebdf569.png)

- Select the values to define your schedule and optionally include email notifications.


1. Select **Create**.


If you need to create an activation for a batch journey, review [Creating a Batch Journey Activation](/products/customer-data-platform/journey-orchestration/batch/creating-a-batch-journey-activation).

## Optionally Configure Export Results in Workflow

See [About Using Workflows to Export Data with the TD Toolbelt](/products/customer-data-platform/data-workbench/workflows/exporting-data-with-parameters) for more information on using data connectors in a workflow to export data.

### Examples of Exporting Events for Profiles

Using Basic Auth:

```yaml
timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-target:
  td>: queries/sample.sql
  result_connection: your_connections_name
  result_settings:
    login_url: https://{example}.zendesk.com
    auth_method: basic
    username: {username}
    password: {password}
    target: event_profile
    skip_invalid_records: true
```

Using Auth Token:

```yaml
timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-target:
  td>: queries/sample.sql
  result_connection: your_connections_name
  result_settings:
    login_url: https://{example}.zendesk.com
    auth_method: token
    username: {username}
    token: {token}
    target: event_profile
    skip_invalid_records: true
```

Using OAuth Token

```yaml
timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-target:
  td>: queries/sample.sql
  result_connection: your_connections_name
  result_settings:
    login_url: https://{example}.zendesk.com
    auth_method: oauth
    access_token: {access_token}
    target: event_profile
    skip_invalid_records: true
```

Using OAuth Client Credentials:

```yaml
timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-target:
  td>: queries/sample.sql
  result_connection: your_connections_name
  result_settings:
    auth_method: client_credentials
    subdomain: {example}
    client_id: {client_id}
    client_secret: {client_secret}
    target: event_profile
    skip_invalid_records: true
```

`client_credentials` takes `subdomain` instead of `login_url`. Treasure AI exchanges the client ID and secret for a short-lived access token and refreshes it automatically during the job.

### Examples of Exporting Events for Profile ID

Using Basic Auth

```yaml
timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-target:
  td>: queries/sample.sql
  result_connection: your_connections_name
  result_settings:
    login_url: https://{example}.zendesk.com
    auth_method: basic
    username: {username}
    password: {password}
    target: event_profile_id
    skip_invalid_records: true
```

Using Basic Auth

```yaml
timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-target:
  td>: queries/sample.sql
  result_connection: your_connections_name
  result_settings:
    login_url: https://{example}.zendesk.com
    auth_method: basic
    username: {username}
    password: {password}
    target: event_user_id
    skip_invalid_records: true
```