An Node Express app for Zendesk that uses GPT-3 to triage and summarize tickets.
๐ฆ Ticket Triage: Use GPT-3 to triage new incoming tickets to include a priority, summary note, and group assignee.
๐ Summarize Tickets: reduce long ticket discussions for use-cases like agent handoff.
- Zendesk Support: You can create a free trial by following these instructions.
- Zendesk CLI: Follow these instructions.
- OpenAI account: You can create one here.
- Ngrok: If you're running the app locally, you'll need a tunnel service like Ngrok so that Zendesk webhooks can reach your localhost.
Clone the sample app, install dependencies, and create a .env
file to store API keys:
# Clone the repository:
$ git clone [repo name]
# Switch to the app's directory:
$ cd openai-zendesk
# Install dependencies:
$ npm install
# Copy the example .env file:
$ cp .env.example .env
Configure four values in your .env file:
- Zendesk Email: This can be your email or someone else's. You might want to create a separate user account named "Agent Assist Bot" so it's clear who is posting on the tickets.
- Zendek API Key: You can create one in the Zendesk Admin portal under
Apps & Integrations > Zendesk API
. - Zendesk Remote URI: The API URL for your Zendesk instance. It will look like:
https://{{your_custom_subdomain}}.zendesk.com/api/v2
. - OpenAI API Key: you can create one here.
When running locally, the app uses the Zendesk CLI to serve the front-end assets
folder to an iframe in Zendesk. The express app runs as a back-end and connects Zendesk to the GPT-3 API.
Use NPM to start up your app backend like this:
# Restart automatically if you make changes:
$ npm run dev
# Just run the app:
$ npm run start
You can serve the app's front-end using the Zendesk CLI:
$ zcli apps:server
Now open a Zendesk Support ticket, adding ?zcli_apps=true
to the end of the URL, for example: https://{{your_custom_subdomain}}.zendesk.com/agent/tickets/1?zcli_apps=true
If all goes well, you'll see the Ticket Summary interface loaded in the sidebar. If you click on the "Summarize Ticket" button a note should appear on the ticket summarizing the conversation.
The openai-zendesk integration can auto-triage tickets so that each ticket receives a priority, group assignee, and summary comment. This process has three steps:
- Run Ngrok as a tunnel to your local environment
- Create a Zendesk Webhook
- Create a Zendesk Trigger that calls your webhook
To receive webhooks locally, you'll need to spin up Ngrok pointed at your express app:
$ ngrok http 3000
Once Ngrok is running, create a Zendesk Webhook:
- In Zendesk Admin go to
Apps & Integrations > Webhooks
. - Click on
Create Webhook
and then click onTrigger or Automation
.
- Give your webhook a name, and set
{{your-ngrok-url}}/triage
as the Endpoint URL. - Then, click create webhook.
To create a Zendesk Trigger, follow these steps:
- Go to
Zendesk Admin > Objects and Rules > Triggers > Click on Add Trigger
- Under conditions, determine when you want the trigger to fire. In our case, we fire the trigger when the ticket is new, has no priority, and doesn't have an owner.
- Under the Actions section, select
Notify active webhook
and then select the name of the webhook you created. - Set the JSON body of the request to include the ticket id:
{
"ticket_id": "{{ticket.id}}"
}
To test our your webhook integration, create a new ticket. Your app should receive a webhook within 3 - 5 seconds triggering the ticket to be processed and triaged.