Getting Started

Prerequisites

Before starting the integration of the Zendesk SDK, please ensure that the following prerequisites are fulfilled.

Supported Unity versions

Supported versions: 2020 LTS, 2021 LTS and 2022 LTS.

Checking your account requirements

You must have a Zendesk account with messaging enabled. See Checking your account requirements for information.

Adding the Zendesk SDK for Unity package

Adding a scoped registry

In the Unity Editor, click Project Settings > Package Manager and expand the Scoped Registries group.

Enter the following registry details and click Save.

Name: ZendeskURL: https://zendesk.jfrog.io/artifactory/api/npm/unity-sdkScopes: com.zendesk.messaging

Installing the Zendesk SDK for Unity package

In the Unity Editor, open the Package Manager by selecting Window > Package Manager. Browse or search for Zendesk SDK for Unity package, select it from the list, and then click Install. For more information, see the Package Manager window documentation.

Installing Sample scenes

To install samples, select Import next to the desired sample in the package details tab.

Dependencies

Please consult the list of dependencies used in our SDK.

Note on Newtonsoft.Json dependency

Our SDK uses Newtonsoft.Json and maintains compatibility with Unity's fork. For more information, see Newtonsoft Json Unity Package.

Obtain a channel id from Zendesk's Admin Center

Before you initialize your SDK, you'll need to obtain a channel id. The channel id is a unique identifier that the SDK requires to initialize correctly. You can obtain it from the Zendesk Admin Center. For instructions, see Working with messaging in the Zendesk SDKs for Android and iOS. If you're not a Zendesk admin on your account, ask one to get it for you.

Initialize the SDK

  1. Add the following import to your project:

    C#

    using Zendesk.Runtime.SDK;
  2. Call await ZendeskSdk.InitializeAsync(config => config.ChannelId = "channelId");.

    Optional parameters:

    • Language: Language of the SDK of type "ZendeskLanguage". If not set, it defaults to the device language.

    C#

    await ZendeskSdk.InitializeAsync(config =>{    config.ChannelId = "channelId";    config.Language = ZendeskLanguage.English;});

Show the conversation

  1. Call the ShowMessagingAsync() method from the ZendeskSdk.Instance.Messaging instance.

    Optional parameters:

    • parentTransform: Parent transform that the Zendesk prefab will be child of, or null (zendesk prefab will be instantiated at the root of the first canvas).

    C#

    await ZendeskSdk.Instance.Messaging.ShowMessagingAsync();

Once ShowMessagingAsync() is called, the Zendesk Messaging UI is displayed.

Troubleshooting

Logging

If you have difficulty getting started, or want to see more detailed information from the SDK, enable logging using the following C# code:

using Zendesk.Runtime.Logging;
ZendeskLogger.SetEnabled(true);

You can check the state of the Logger by using:

ZendeskLogger.IsLogEnabled();

IL2CPP Stripping

If you are using IL2CPP, you may be using the Managed Stripping Level property to decrease the size of your app.

The Zendesk SDK functions as expected with Managed Stripping Level set to minimum. If you set it to any other level, you must include a link.xml file in the Unity Assets folder with the following contents. Otherwise, your code may throw unexpected errors and exceptions.

<linker>       <assembly fullname="Unity.Zendesk" preserve="all"/>       <assembly fullname="Unity.Zendesk.MessagingCore" preserve="all"/></linker>

The above code disables stripping for the Zendesk SDK assemblies.

Next Steps

Once you complete the above steps, you are now in good shape to explore the SDK and understand how messaging will work for your business and your end users.