Skip to content

Commit 7f0cc68

Browse files
committed
WIP: Add Zendesk Auth Provider docs
1 parent 7feb681 commit 7f0cc68

5 files changed

Lines changed: 226 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
auth:
2+
providers:
3+
- id: zendesk
4+
description: "Custom Zendesk provider"
5+
enabled: true
6+
type: oauth2
7+
client_id: ${env:ZENDESK_CLIENT_ID}
8+
oauth2:
9+
scope_delimiter: ' '
10+
pkce:
11+
enabled: true
12+
code_challenge_method: S256
13+
authorize_request:
14+
endpoint: 'https://<your-zendesk-subdomain>.zendesk.com/oauth/authorizations/new'
15+
params:
16+
client_id: '{{client_id}}'
17+
redirect_uri: '{{redirect_uri}}'
18+
scope: '{{scopes}} {{existing_scopes}}'
19+
response_type: code
20+
token_request:
21+
endpoint: 'https://<your-zendesk-subdomain>.zendesk.com/oauth/tokens'
22+
params:
23+
grant_type: authorization_code
24+
client_id: '{{client_id}}'
25+
redirect_uri: '{{redirect_uri}}'
26+
response_content_type: application/json
27+
response_map:
28+
access_token: '$.access_token'
29+
refresh_token: '$.refresh_token'
30+
expires_in: '$.expires_in'
31+
scope: '$.scope'
32+
refresh_request:
33+
endpoint: 'https://<your-zendesk-subdomain>.zendesk.com/oauth/tokens'
34+
params:
35+
grant_type: refresh_token
36+
refresh_token: '{{refresh_token}}'
37+
client_id: '{{client_id}}'
38+
response_content_type: application/json
39+
response_map:
40+
access_token: '$.access_token'
41+
refresh_token: '$.refresh_token'
42+
expires_in: '$.expires_in'
43+
scope: '$.scope'

examples/code/integrations/zendesk/custom_auth.js

Whitespace-only changes.

examples/code/integrations/zendesk/custom_auth.py

Whitespace-only changes.

examples/code/integrations/zendesk/custom_tool.py

Whitespace-only changes.
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
import { Tabs } from "nextra/components";
2+
import { SignupLink } from "@/components/Analytics";
3+
4+
# Zendesk Auth Provider
5+
6+
<Note>
7+
Arcade does not offer a default Zendesk Auth Provider. To use Zendesk auth, you must create
8+
a [custom provider configuration](/home/auth-providers/oauth2) as described below.
9+
</Note>
10+
11+
The Zendesk auth provider enables tools and agents to call Zendesk APIs on behalf of a user. Behind the scenes, the Arcade Engine and the Zendesk auth provider seamlessly manage Zendesk OAuth 2.0 authorization for your users.
12+
13+
## What's documented here
14+
15+
This page describes how to use and configure Zendesk auth with Arcade.
16+
17+
This auth provider is used by:
18+
19+
- The [Arcade Zendesk toolkit](/toolkits/customer-support/zendesk), which provides pre-built tools for interacting with Zendesk services
20+
- Your [app code](#calling-zendesk-apis-directly) that needs to call Zendesk APIs
21+
- Or, your [custom tools](#create-your-own-zendesk-tools) that need to call Zendesk APIs
22+
23+
## Create a Zendesk app
24+
25+
To create a Zendesk app, there are two important guides from Zendesk that you can follow:
26+
1. [Using OAuth authentication with your application](https://support.zendesk.com/hc/en-us/articles/4408845965210-Using-OAuth-authentication-with-your-application)
27+
2. [Set up a global OAuth client](https://developer.zendesk.com/documentation/marketplace/building-a-marketplace-app/set-up-a-global-oauth-client/)
28+
29+
For a more streamlined set of instructions, follow the steps below:
30+
1. Create your Organization in the [Zendesk Marketplace portal](https://apps.zendesk.com/).
31+
1. Create a Zendesk support account at https://www.zendesk.com/login . If you need a global OAuth client, then the subdomain MUST begin with "d3v-". You will need a global OAuth client if your app will use integrations/tools for multiple customers with their own Zendesk instances (multiple subdomains).
32+
1. In [the Admin Center](https://support.zendesk.com/hc/en-us/articles/4581766374554#topic_hfg_dyz_1hb), click "Apps and integrations" in the sidebar, then select APIs > OAuth clients > Add OAuth client.
33+
* Ensure your identifier is prefixed with "zdg-" If you will need a global OAuth client.
34+
* Select "Public" for "Client kind".
35+
* Use `https://cloud.arcade.dev/api/v1/oauth/callback` as your "Redirect URL".
36+
1. Copy and store your identifier for later. This will be your **Client ID**.
37+
1. Copy and store your generated secret for later. This will be your **Client Secret**.
38+
1. (Only for Global OAuth client) Request a global OAuth client.
39+
* Sign into the [Zendesk Marketplace portal](https://apps.zendesk.com/)
40+
* Organization > Global OAuth Request and fill out the form. Zendesk will typically review your request within 1 week.
41+
42+
43+
44+
## Get your Zendesk subdomain
45+
46+
Your Zendesk subdomain is the value before the `.zendesk.com` part. For example, if your Zendesk domain is `https://d3v-acme-inc.zendesk.com`, your Zendesk subdomain is `d3v-acme-inc`. Take note of your Zendesk subdomain. You will need this value in the next steps.
47+
48+
## Set the Zendesk Subdomain Secret
49+
50+
Set the `ZENDESK_SUBDOMAIN` secret in the [Arcade Dashboard](https://api.arcade.dev/dashboard/auth/secrets).
51+
52+
## Configuring Zendesk Auth
53+
54+
You can either configure Zendesk auth from the Arcade Dashboard or in the `engine.yaml` file if you are running the Engine yourself. We describe both options below.
55+
56+
<Tabs items={["Dashboard GUI", "Engine Configuration YAML"]}>
57+
<Tabs.Tab>
58+
59+
### Configure Zendesk Auth Using the Arcade Dashboard GUI
60+
61+
<Steps>
62+
63+
#### Access the Arcade Dashboard
64+
65+
Navigate to the [Arcade Dashboard](https://api.arcade.dev/dashboard/auth/oauth) OAuth Providers page.
66+
67+
#### Navigate to the Add Custom Provider page
68+
69+
- Click **Add OAuth Provider** in the top right corner.
70+
- Click the **Custom Provider** tab at the top.
71+
72+
#### Enter the provider details
73+
74+
- ID: `zendesk`
75+
- Description: `<your description>`
76+
- Client ID: `<your identifier>` (This is prefixed with `zdg-` if you are using a global OAuth client)
77+
- Client Secret: `<your client secret>`
78+
- Authorization Endpoint: `https://<your-zendesk-subdomain>.zendesk.com/oauth/authorizations/new`
79+
- Token Endpoint: `https://<your-zendesk-subdomain>.zendesk.com/oauth/tokens`
80+
- PKCE Settings:
81+
- Enable PKCE: `enabled`
82+
- PKCE Method: `S256` (Default)
83+
- Authorization Settings:
84+
- Response Type: `code` (Default)
85+
- Scope: `{{scopes}} {{existing_scopes}}` (Default)
86+
- Token Settings:
87+
- Authentication Method: `Client Secret Basic` (Default)
88+
- Response Content Type: `application/json` (Default)
89+
- Refresh Token Settings:
90+
- Refresh Token Endpoint: `https://<your-zendesk-subdomain>.zendesk.com/oauth/tokens`
91+
- Authentication Method: `Client Secret Basic` (Default)
92+
- Response Content Type: `application/json`
93+
- Token Introspection Settings:
94+
- Enable Token Introspection: `disabled` (Default)
95+
96+
</Steps>
97+
</Tabs.Tab>
98+
99+
<Tabs.Tab>
100+
101+
### Configure Zendesk Auth Using the Engine Configuration YAML
102+
103+
<Tip>
104+
Refer to [Engine configuration](/home/local-deployment/configure/engine) for more information on how to set environment variables and configure the Arcade Engine.
105+
</Tip>
106+
107+
<Tip>
108+
To find where the `engine.yaml` file is located in your OS after installing the Arcade Engine, check the [Engine configuration file](/home/local-deployment/configure/overview#engine-configuration-file) documentation.
109+
</Tip>
110+
111+
<Steps>
112+
113+
#### Set environment variables
114+
115+
Set the following environment variables:
116+
117+
```bash
118+
export ZENDESK_CLIENT_ID="<your client ID>"
119+
export ZENDESK_CLIENT_SECRET="<your client secret>"
120+
```
121+
122+
Or, you can set these values in a `.env` file:
123+
124+
```bash
125+
ZENDESK_CLIENT_ID="<your client ID>"
126+
ZENDESK_CLIENT_SECRET="<your client secret>"
127+
```
128+
129+
#### Edit the Engine configuration
130+
131+
<Note>
132+
In the YAML code demonstrated below, replace `<your-zendesk-subdomain>` in the endpoint URLs with your Zendesk subdomain.
133+
</Note>
134+
135+
Edit the `engine.yaml` file by adding a Zendesk item to the `auth.providers` section:
136+
137+
```yaml file=<rootDir>/examples/code/integrations/zendesk/config_provider.engine.yaml {3-43}
138+
139+
```
140+
141+
#### Restart the Arcade Engine
142+
143+
If the Arcade Engine is already running, you will need to restart it for the changes to take effect.
144+
145+
</Steps>
146+
</Tabs.Tab>
147+
148+
</Tabs>
149+
150+
## Using Zendesk auth in app code
151+
152+
Use the Zendesk auth provider you just created in your own agents and AI apps to get a user token for Zendesk APIs. See [authorizing agents with Arcade](/home/auth/how-arcade-helps) to understand how this works.
153+
154+
Use `client.auth.start()` to get a user token for Zendesk APIs:
155+
156+
<Tabs items={["Python", "JavaScript"]} storageKey="preferredLanguage">
157+
<Tabs.Tab>
158+
159+
```python file=<rootDir>/examples/code/integrations/zendesk/custom_auth.py {8-12}
160+
161+
```
162+
163+
</Tabs.Tab>
164+
165+
<Tabs.Tab>
166+
167+
```javascript file=<rootDir>/examples/code/integrations/zendesk/custom_auth.js {8-10}
168+
169+
```
170+
171+
</Tabs.Tab>
172+
173+
</Tabs>
174+
175+
## Using Zendesk auth in custom tools
176+
177+
You can author your own [custom tools](/home/build-tools/create-a-toolkit) that interact with Zendesk APIs.
178+
179+
Use the `OAuth2()` auth class to specify that a tool requires authorization with Zendesk. The `context.authorization.token` field will be automatically populated with the user's Zendesk token:
180+
181+
```python file=<rootDir>/examples/code/integrations/zendesk/custom_tool.py {5-6,9-13,20}
182+
183+
```

0 commit comments

Comments
 (0)