API Reference

This guide will walk you through integrating the Ask-AI external search into Zendesk helpcenter.

Pre-Requirements

  1. Create an external search service with the relevant permissions.
  2. Obtain permission to modify the Zendesk template.

Steps

  1. Navigate to the "Guide Admin" panel.

  2. Customize the theme by going to "Themes" and clicking on "Customize"

  3. Go to code editor by clicking "Edit code"

  4. Update document_head.hbs file:

    <!-- Ask-AI searchbar -->
    <script type="text/javascript" src="https://external-search.ask-ai.co/ask_ai_sb.js"></script>
    <script type="text/javascript">window.renderAskAISearchBar("#query", "TOKEN", {"hostProvider": "zendesk", "langCode": "en"})</script>
    

🚧

Do not forget to update the TOKEN and the selector to the correct one

  1. Publish the results

Common Questions

How can I know what is the correct selector?

📘

Finding the correct selector can be challenging. Here is a recommendation to help you pinpoint the correct selector

To find the correct selector, right-click the element you want to replace with the external search and click on "Inspect":

While pinpointing the correct element, right-click and under "Copy", select "Copy selector"

What happens with the built-in search page?

When Ask-AI external search is used, the built-in search page will NOT be used.

The search bar is not showing, what should I do?

  1. Ensure the configuration was set correctly based on the steps above.
  2. Check for any errors in the console.
  3. Contact Ask-AI support for further assistance.

How to have different permissions for anonymous/logged in/agents?

In order to have different permissions, we need to set API key that holds the necessary permissions per intended group. In the following example, we'll show how to have diffrent permissions for anonymous users, logged in (that are NOT agents) and agents

1. Create API keys

The first step is to create the API keys and assigning the necessary permissions per service, you can do that via the admin portal or reaching out to the assigned CSM.

2. Edit the template

📘

The keys we'll be using are:

  • ANONYMOUS_KEY for anonymous users
  • LOGGED_IN_KEY for logged in users that are NOT agents
  • AGENT_KEY for agents

Follow the previous instructions on how to edit the template and enter the following:

<script type="text/javascript" src="https://external-search.ask-ai.co/ask_ai_sb.js"></script>
{{#if signed_in}}
	{{#if user.agent}}
		<script type="text/javascript">window.renderAskAISearchBar("#query", "AGENT_KEY", {"hostProvider": "zendesk", "langCode": "en"})</script>
	{{else}}
		<script type="text/javascript">window.renderAskAISearchBar("#query", "LOGGED_IN_KEY", {"hostProvider": "zendesk", "langCode": "en"})</script>
	{{/if}}
{{else}}
	<script type="text/javascript">window.renderAskAISearchBar("#query", "ANONYMOUS_KEY", {"hostProvider": "zendesk", "langCode": "en"})</script>
{{/if}}