Generate Zendesk OAuth Tokens
To connect Zendesk to a Knowledge Hub knowledge base, you must either provide your Zendesk credentials to NiCE Professional Services or enter them in Knowledge Hub yourself. This page describes how to generate those credentials, also called OAuth tokens. You should treat the OAuth tokens like passwords. Be sure to store them in a secure location. If you lose them, you'll have to regenerate them.
This method is a developer effort. It requires knowledge of Python and Zendesk admin privileges.
Complete each of these tasks in the order given.
Install Python
Complete this task if you don't already have Python installed on your computer.
-
Run the installer. Select the box for Add python.exe to PATH, then click Install Now.
Create a Zendesk OAuth Client
Create an OAuth client in Zendesk.
-
Sign in to Zendesk Admin Center.
-
In the left menu, navigate to Apps and integrations > Zendesk API.
-
Click the OAuth Clients tab.
-
Click Add OAuth client.
-
Give this OAuth client a Client name and Description.
-
In Unique identifier, enter the value that you want be the client ID.
-
In Client kind, select Confidential if you have a server-side app or Public if you have a client-side app.
-
In Redirect URLs, enter https://{aws-region}.console.aws.amazon.com/appflow/oauth. For example, if you are using the us-west-2 region, enter: https://us-west-2.console.aws.amazon.com/appflow/oauth
-
Click Save.
Copy and Store Client ID and Client Secret
When you create an OAuth client, Zendesk automatically generates the client secret. The client ID is the value you entered in the Unique identifier field. These are two of the credentials needed to connect Zendesk to Knowledge Hub.
-
If you haven't already, open the OAuth client you created in the previous section.
-
Copy the client ID and client secret and store them in a secure location.
Zendesk only shows the client secret for an OAuth client once. If you lose it, you'll need to regenerate it.
Prepare OAuth Tokens
Then, prepare the OAuth tokens for use in your Python script by using the template below.
-
Copy and paste the following lines of code into a text editor:
CLIENT_ID = "[Enter client ID]" CLIENT_SECRET = "[Enter client secret]" REDIRECT_URI = "[Enter redirect URL]" AUTH_URL = "https://[subdomain].zendesk.com/oauth/authorizations/new" TOKEN_URL = "https://[subdomain].zendesk.com/oauth/tokens"
-
Change the value of the CLIENT_ID attribute to the client ID of the OAuth client you created.
-
Change the value of the CLIENT_SECRET attribute to the client secret of the OAuth client you created.
-
Change the value of the REDIRECT_URI attribute to https://{aws-region}.console.aws.amazon.com/appflow/oauth. This should match the URL you entered in the Redirect URLs field in the OAuth client you created. For example, if you are using the aws-west-2 region, enter: https://us-west-2.console.aws.amazon.com/appflow/oauth
-
Change the value of the AUTH_URL attribute to include your Zendesk subdomain. For example, AUTH_URL = "https://classics.zendesk.com/oauth/authorizations/new".
-
Change the value of the TOKEN_URL attribute to include your Zendesk subdomain. For example, TOKEN_URL = "https://classics.zendesk.com/oauth/tokens".
Run the Python Script
Finally, run a Python script to retrieve your Zendesk auth code and access token.
-
Open a text editor and start a Python file.
-
Copy and paste the lines of code from this TXT file into your Python file.
-
Replace the values of lines 9 through 13 with the OAuth tokens you prepared.
-
Open any IDE and run the Python script.
-
Copy the URL the script generates. Paste it into your browser.
-
Allow the script to connect to your Zendesk instance.
-
Copy the URL of the page that appears. It should begin with https://us-west-2.console.aws.amazon.com/appflow/oauth?code=.
-
Navigate back to your IDE. Paste the URL after the prompt Enter the redirected URL:.
-
Press Enter. Your auth code and access token are generated in a TXT file. That file is automatically saved to your desktop.