One of the lesser known and used APIs in Zendesk's arsenal is the Answer Bot API. It allows platforms to replicate the behaviour of AnswerBot in any app or website. Or an Apple HomePod, but more on that later.
Use cases where this might be useful are for example:
- Show three suggested articles below a contact form not hosted on Zendesk Guide.
- Based on the product the customer is looking at, load some support suggestions dynamically
- Load Zendesk Articles in a third party bot that's not natively connected to Zendesk.
The API flow runs as follows:
- Get a query from your end-user and
POSTit to the Answer Bot recommendations endpoint.
- That endpoint returns an array of 3
- You can then use one of two endpoints to either confirm a resolution, or reject the suggestions with a reason.
- It's up to your app to then handle the reject with an escalation to a webform, suggest more articles...
Exploring an API is only fun if we have a good use case to test it on.
For this example we'll create a small webpage that allows you to get recommendations and reject/accept them.
But first, the demo. This small website allows you to enter a search query. It then pulls in data from our Demo Help Center and returns the three recommended articles.
You can then mark them as good or bad to train the data set.
You can use this sample website to e.g. embed Answer Bot on your own website. All sample code is provided below.
Taking this one step further.
While playing around with the Answer Bot API I remembered that Siri can also do API calls.. so I build a little demo. Just for the fun of it. 😎
You can download the Apple Shortcut below.
Answer Bot API Tutorial
In our demo we handle the connection to AnswerBot via a separate script running on Cloudflare Workers. This makes it possible to hide the API tokens from end-users and add some caching to the returned data, meaning you don't hit your API limits on Zendesk as fast.