About the integration builder for AI agents

<p style="display: none;" id="docs-hc-snippet">Zendesk AI agents are AI-powered chatbots that interact with your customers on messaging, email (including API and web form), and voice (EAP) channels. They can have conversations with customers and perform actions in authorized systems autonomously, automating and resolving issues so that your human agents can focus on more complex work.</p><div class="article-banners">
<div id="docs-wmp-link"><a href="https://support.zendesk.com/hc/en-us/articles/5411234991258-plan" target="_blank" rel="noopener noreferrer">What's my plan?</a></div>
<div class="article-banner" id="suite_all"><figure class="wysiwyg-table wysiwyg-table-align-left"><table style="margin-left: 0px; margin-right: auto;"><tbody><tr>
<td><strong>All Suites</strong></td>
<td>Team, Growth, Professional, Enterprise, or Enterprise Plus</td>
</tr></tbody></table></figure></div>
<div class="article-banner" id="support_all"><figure class="wysiwyg-table wysiwyg-table-align-left"><table style="margin-left: 0px; margin-right: auto;"><tbody><tr>
<td><strong>Support</strong></td>
<td>Team, Professional, or Enterprise</td>
</tr></tbody></table></figure></div>
</div><p>The integration builder is a powerful no-code tool that enables you to connect your AI agent to any API or data source without extended technical or programming skills. Personalize your chat experiences and drive higher automated resolutions with dynamic content.</p><p>Imagine an AI agent that can seamlessly access customer information from your back office system, retrieve data from any other external data source, or interact with third-party applications, all without requiring you to write a single line of code.</p><p>With dynamic content capabilities, the integration builder allows for real-time data retrieval, analysis, and transformation, enabling your AI agent to provide tailored responses, recommendations, and solutions based on individual user needs.</p><p>With its user-friendly interface, intuitive features, and no-code functionalities, the integration builder offers full flexibility and customization without the need for extensive technical knowledge.</p><p>In this article, we will explore the key features and benefits of the integration builder, along with a step-by-step guide on how to harness its capabilities to connect your AI agent to any API or data source.</p><ul>
<li data-list-item-id="e75c7bb52e5e1585ec82ab9162bea5615"><a href="#h_01HAY9KGH0YC6ZH7800G5VZCNG">Getting started</a></li>
<li data-list-item-id="e48cd7c0b770ae7a8a4b4987c11e9a7e1"><a href="#h_01HAY9KGH06WFPD1BMJAPA3D0Q">Request parameters</a></li>
<li data-list-item-id="ecf8d79649e7887001f2b2d803b5b7abd"><a href="#h_01HAY9KGH0CWG0E9T0BEAJ7772">Environments</a></li>
<li data-list-item-id="e1df61ae22ae8236d2d199c5e7f219e10"><a href="#h_01HAY9KGH0W4XZ3BSZ8XPT9R51">Test functionality</a></li>
<li data-list-item-id="ef07ed2b8875cbcbc6b6cb708fdb91ac7"><a href="#h_01HAY9KGH1TPKF9B3C9KN6P7E2">Scenarios</a></li>
</ul><h2 id="h_01HAY9KGH0YC6ZH7800G5VZCNG">Getting started</h2><p>To access the integration builder, simply click on "API integrations" in the side navigation menu. This will take you to an overview list where all your future integrations will be conveniently listed and accessible. Initially, you will start with either no API integrations or an example API integration, depending on your onboarding journey.</p><p>To create a new integration, click on "Add Integration" located in the top right corner.<br>Provide a name for the integration,<br>Add a short description with additional context.</p><div class="note">
<span class="notetitle">Note:</span> For APIs to be used by an <a href="https://support.zendesk.com/hc/en-us/articles/8966284087066">AI agent with agentic AI</a> at the right time and in the right context, it’s extremely important to add a clear description. Make sure your description covers what the API is, how to use it, and the meaning of different parameters.</div><p>Once done, click "Save" to proceed to the integration configuration page.</p><p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867222715410.png" alt="Screenshot" width="850"></p><p>If you can’t see API integrations in the side navigation, this most probably means that you are not a Client Admin. We currently restrict access to the integration builder to Client Admins only. In this case, please contact your CSM to discuss your access rights.</p><p>In case you prefer learning with video and audio input, we have an introduction video below by a member of our custom engineering team, Chloe.</p><p><iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/DIfTq__7Y3w?si=FruyCJCA0l1OTe8i" width="560"></iframe></p><h2 id="h_01HAY9KGH06WFPD1BMJAPA3D0Q">Request parameters</h2><p>To begin, you need to configure the necessary request parameters to ensure a successful response from the API. These request parameters contain information derived from the conversation and serve to define the specifics of the API request. For instance, if you intend to retrieve particular user information to display during the conversation, it becomes crucial to include the userID as part of the request. This ensures that the API response contains data relevant to the current user or visitor engaged in the chat.</p><p>Below is an example of a configured request parameter.</p><p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867222717202.png" alt="Screenshot" width="850"></p><p>In addition to specifying the key and request parameter type, you have the option to set a test value. It is highly recommended to do so, as this test value will be used during configuration when utilizing the test functionality in the top right corner. During an actual live conversation, the value will be passed to the API integration before making the request. However, since we lack the context of the current live conversation, setting a test value is necessary to successfully perform an API call.</p><p>The "required" checkbox allows you to determine whether the request parameter is optional or needs to be gathered before calling the API integrations in the conversation if it hasn't already been saved in the session.</p><p>The inclusion of request parameters depends on the specific requirements of the API being called. For some APIs, the request parameters are appended to the URL, while for others, they are included in the headers or body of the request. Please consult your API documentation to determine where the request parameter should be included. Once identified, you can add the request parameter to the URL, header, or body by simply referencing the key surrounded by double curly brackets - {{userID}}.</p><p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867222720018.png" alt="Screenshot" width="850"></p><h2 id="h_01HAY9KGH0CWG0E9T0BEAJ7772">Environments</h2><p>Once the request parameter is added, the primary setup for the API call can be performed within the environment section. Adjacent to the environment name that appears during integration testing or when referring to it in the dialogue builder, you need to choose the method, URL, and Authorization type based on the underlying API documentation. </p><h3 id="h_01HAY9KGH0SB33QZ11B2860SB0"><span style="color: #434343;">Authorization types</span></h3><p>We offer the following Authorization types:</p><div><figure class="wysiwyg-table wysiwyg-table-align-left" style="width: 100%;"><table class="wysiwyg-table-resized" style="margin-left: 0px; margin-right: auto;">
<colgroup>
<col style="width: NaN%;">
<col style="width: NaN%;">
<col style="width: NaN%;">
</colgroup>
<tbody>
<tr>
<td>Authorization type</td>
<td>Description</td>
<td>Example</td>
</tr>
<tr>
<td>API Key</td>
<td>A simple API key that should be provided by the API owner</td>
<td><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867236194578.png"></td>
</tr>
<tr>
<td>Bearer Token</td>
<td>Another token that should be provided by the API owner</td>
<td><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867236195474.png"></td>
</tr>
<tr>
<td>Basic Auth</td>
<td>A username and password are used to authenticate with the API</td>
<td><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867222721554.png"></td>
</tr>
<tr>
<td>OAuth 2.0</td>
<td>Several Authentication information is needed based on the grant type</td>
<td><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867222724754.png" alt="Screenshot"></td>
</tr>
<tr>
<td>AWS signature</td>
<td>A protocol used to securely authenticate API requests sent to Amazon Web Services (AWS)</td>
<td>
<p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/aia_aws_signature_example.png" width="250"></p>
<p>See <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html">AWS Signature Version 4 for API requests</a>.</p>
</td>
</tr>
<tr>
<td>Custom</td>
<td>Authorization via expiration token</td>
<td>See <a href="https://support.zendesk.com/hc/en-us/articles/8357749813658">Using custom authorization with the integration builder</a>.</td>
</tr>
</tbody>
</table></figure></div><p>Please remember to include the auth token in the request by adding it as {{apiToken}} to the headers for all authorization types (except for no authorization). Take a look at the header section for an example. </p><h3 id="h_01HAY9KGH0N25WMR1KECVG90K0"><span style="color: #434343;">Headers</span></h3><p>Headers contain additional information about the request or the client and server communicating with each other. They are key-value pairs included in the request's header section. Some commonly used headers include:</p><ul>
<li data-list-item-id="e81a5cb03d6b193613aa3ddaa515b3bb9">Content-Type: Indicates the format of the data in the request body (e.g., JSON, XML, form data).</li>
<li data-list-item-id="e45c6efc6cce42b7e86419ff3301f3895">Authorization: Provides credentials or tokens to authenticate the client making the request.</li>
<li data-list-item-id="e94f2a1348375e432cb4499823feda5d9">User-Agent: Specifies the user agent initiating the request, typically the web browser or client application.</li>
<li data-list-item-id="ec78e714532d403828eb5e3c2d50d1194">Accept: Informs the server about the response formats accepted by the client.</li>
<li data-list-item-id="e90c7d4455231e017715e138c352cd548">Cache-Control: Defines caching directives for the server or intermediary caches.</li>
<li data-list-item-id="e0fc375480aeda97fbf2335a271f87018">X-Requested-With: Identifies the type of request (e.g., XMLHttpRequest, Fetch API) made by the client.</li>
</ul><p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867222725778.png" alt="Screenshot" width="850"></p><h3 id="h_01HAY9KGH05PBN9GDCDM91B9D1"><span style="color: #434343;">Body </span></h3><p>The body of an API request contains the data sent to the API. It is typically used in requests that require input data for processing or data manipulation on the API side. The body can contain various formats, such as JSON, XML, plain text, or form data, depending on the API and the specific endpoint being called. In our case, we only support JSON so far. </p><p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_13906741866770.png" alt="Screenshot 2023-09-22 at 13.13.47.png" width="614" height="235"></p><h3 id="h_01HAY9KGH08Q5CPMXV8PJB78D7"><span style="color: #434343;">Managing environments</span></h3><p>In order to address the challenges of handling sandbox and production environments for APIs, we have incorporated the concept of environments into the integration builder. Alongside the default main environment that is automatically created when setting up an integration, you have the flexibility to include additional environments.</p><p>These additional environments allow you to customize the URL, authentication details, headers, and body of requests, enabling you to target specific sandbox or production environments within your API. </p><p>To create a new environment, simply click on the "+" button located beside the Environment section. If you wish to replicate an existing environment, hover over it and choose the "duplicate" option from the three-dot menu. Keep in mind that only one environment can be set as the default, which will be positioned at the top of the list and automatically selected first in the dialogue builder (unless intentionally modified). </p><p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867236211474.png" alt="Screenshot" width="850"></p><p>If an environment is not being utilized by any AI agents and it is either the sole environment or the default environment, it can be deleted. To modify the default settings, you can easily select the appropriate option from the three-dot menu.</p><p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867222730770.png" alt="Screenshot" width="850"></p><h2 id="h_01HAY9KGH0W4XZ3BSZ8XPT9R51">Test functionality</h2><p>Once you have completed the setup of the API request, it is helpful to verify if all configurations were done correctly. To facilitate this process, the integration builder offers a convenient testing functionality located at the top right corner.</p><p>The test button is easily identifiable by the label "Test" followed by the name of the default environment. By clicking on it, the integration builder initiates a request to the API using the provided information from the request parameters and environment sections. The response received from the API is then displayed in the Test Integration section on the right-hand side of the interface. If you wish to test the API using the request details from a different environment, simply select the desired environment from the dropdown menu within the test functionality and click the test button again.</p><p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867222732178.png" alt="Screenshot" width="850"></p><h3 id="h_01HAY9KGH02W0QDBY1X3J5NDP4"><span style="color: #434343;">Response Content</span></h3><p>Within the Test Integration section, the integration builder presents the response obtained from the API. The content of the response is organized into the following objects: </p><p><br><br> </p><div>
<figure class="wysiwyg-table wysiwyg-table-align-left" style="width: 100%;"><table class="wysiwyg-table-resized" style="margin-left: 0px; margin-right: auto;">
<colgroup>
<col style="width: NaN%;">
<col style="width: NaN%;">
<col style="width: NaN%;">
</colgroup>
<tbody>
<tr>
<td>Objects</td>
<td>Content</td>
<td>Example</td>
</tr>
<tr>
<td>statusCode</td>
<td>HTTP response status codes indicate whether a specific HTTP request has been successfully completed. <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status"><span class="wysiwyg-underline">Learn more</span></a>. </td>
<td>
<span style="color: #a31515;">"statusCode"</span>: <span style="color: #098658;">200</span>
</td>
</tr>
<tr>
<td>data</td>
<td>The data object showcases the relevant data of the API in the event of a successful request. However, if the request is unsuccessful, it provides additional information based on the corresponding status codes.</td>
<td>
<p><span style="color: #a31515;">"data"</span>: {</p>
<p>   <span style="color: #a31515;">"name"</span>: <span style="color: #0451a5;">"Germany"</span>,</p>
<p>   <span style="color: #a31515;">"capital"</span>: <span style="color: #0451a5;">"Berlin"</span>,</p>
<p>   <span style="color: #a31515;">"region"</span>: <span style="color: #0451a5;">"Europe"</span>,</p>
<p>   <span style="color: #a31515;">"population"</span>: <span style="color: #098658;">83240525</span>,</p>
<p>   <span style="color: #a31515;">"area"</span>: <span style="color: #098658;">357114</span> }</p>
</td>
</tr>
<tr>
<td>requestParameters</td>
<td>Within the requestParameters object, the integration builder exhibits the request parameters along with the associated test values employed to invoke the API.</td>
<td>
<p><span style="color: #a31515;">"requestParameters"</span>: {</p>
<p>   <span style="color: #a31515;">"country"</span>: <span style="color: #0451a5;">"de"</span>}</p>
</td>
</tr>
</tbody>
</table></figure><h4 id="h_01HAY9KGH1DBHX93PMDKD18G34">Before utilizing the test functionality again to examine the integration with any modified configurations, please ensure to save the integration.</h4>
<p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867236219282.png" alt="Screenshot" width="850"></p>
<h2 id="h_01HAY9KGH1TPKF9B3C9KN6P7E2">Scenarios</h2>
<p>Each newly created integration includes three pre-configured scenarios. While two of these scenarios can be customized or deleted according to your needs, the third scenario, named "Fallback," cannot be edited. This "Fallback" scenario functions as the primary fallback option in case none of the previous scenarios get triggered.</p>
<div><figure class="wysiwyg-table wysiwyg-table-align-left" style="width: 100%;"><table class="wysiwyg-table-resized" style="margin-left: 0px; margin-right: auto;">
<colgroup>
<col style="width: NaN%;">
<col style="width: NaN%;">
<col style="width: NaN%;">
</colgroup>
<tbody>
<tr>
<td>Scenario</td>
<td>Default query</td>
<td>Description</td>
</tr>
<tr>
<td>Success</td>
<td>statusCode &gt;= 200 and statusCode &lt; 300</td>
<td>The scenario that should capture the preferred/happy path if the statusCode is between 200 and 300. </td>
</tr>
<tr>
<td>Failure</td>
<td>statusCode &lt; 200 or statusCode &gt;= 300</td>
<td>The scenario that should capture the unsuccessful path if the statusCode is outside of 2XX. </td>
</tr>
<tr>
<td>Fallback</td>
<td>- </td>
<td>Fallback scenario to always trigger at least one scenario.</td>
</tr>
</tbody>
</table></figure></div>
<p>Scenarios are equivalent with the different branches the conversation follows on the dialogue when the API integration is triggered. </p>
<p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867236220178.png" alt="Screenshot" width="850"></p>
<h3 id="h_01HAY9KGH119VRVW4F1TTGXGZ2"><span style="color: #434343;">Scenario queries</span></h3>
<p>Only one scenario can be triggered for each API integration. The logic for determining which scenario gets triggered during a conversation is based on the Scenario Queries and the order in which the scenarios are defined.</p>
<p>The Scenario Queries represent the conditions that must be met in order to trigger a specific scenario. To determine if a condition is true, the integration builder examines the Scenario Query as well as the data contained in the API response. Commonly used data fields include statusCodes, API-specific data within the data object of the API response, and possibly even values from the request parameters. </p>
<p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11867236223762.png" alt="Screenshot" width="850"></p>
<p>The Success scenario's default scenario query requires the API response's statusCode to be within the range of 200 to 300. If this condition is met, the Success scenario will be triggered.</p>
<p>Since the default scenario queries can be modified and new scenarios can be added, it is possible for multiple scenario queries from different scenarios to be true based on the API response. In such cases, the order of the scenarios determines which scenario will be triggered.</p>
<p>To provide visual feedback, we have implemented a feature that indicates which scenario would be triggered based on the current API response. It also identifies scenarios that would theoretically be triggered but are not actually triggered due to a higher-order scenario being triggered. Additionally, it highlights scenarios that would not be triggered because their conditions are not fulfilled.</p>
<div><figure class="wysiwyg-table wysiwyg-table-align-left" style="height: 154px; width: 100%;"><table class="wysiwyg-table-resized" style="margin-left: 0px; margin-right: auto;">
<colgroup>
<col style="width: NaN%;">
<col style="width: NaN%;">
<col style="width: NaN%;">
</colgroup>
<tbody>
<tr style="height: 22px;">
<td style="height: 22px;">Criteria match</td>
<td style="height: 22px;">Visualisation</td>
<td style="height: 22px;">Description</td>
</tr>
<tr style="height: 44px;">
<td style="height: 44px;">Criteria matches first in order</td>
<td style="height: 44px;"><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11879016509458.png" alt="Screenshot"></td>
<td style="height: 44px;">The scenario highlighted by a blue solit dot represents the scenario that will be triggered.</td>
</tr>
<tr style="height: 44px;">
<td style="height: 44px;">Criteria doesn’t match</td>
<td style="height: 44px;"><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11879042896914.png" alt="Screenshot"></td>
<td style="height: 44px;">The scenario(s) highlighted by an empty dot will not be triggered.</td>
</tr>
<tr style="height: 44px;">
<td style="height: 44px;">Criteria matches but not first in order</td>
<td style="height: 44px;"><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11879016513298.png" alt="Screenshot"></td>
<td style="height: 44px;">The scenario(s) represented by a grey solid dot would only be theoretically triggered.</td>
</tr>
</tbody>
</table></figure></div>
<p>To modify the order of scenarios, simply click on a scenario and rearrange the order by dragging it. Except for the Fallback scenario, which always remains in the last position, you can adjust the order according to your preference.</p>
<h3 id="h_01HAY9KGH1R8BR470VCQK4PASE"><span style="color: #434343;">Session parameters</span></h3>
<p>When configuring each scenario, you have the ability to enhance the conversation with various data points from your backend systems. You can specify the desired data to be accessible for each scenario by transforming and storing relevant information from the API response into session parameters. These session parameters can then be utilized in the dialogue-building process to present information to visitors or to map out the underlying workflow.</p>
<p>A session parameter is defined by a key-value pair. The key serves as a reference within the dialogue builder, while the query is employed to transform and extract specific data from the API response to save the value. The integration builder provides real-time feedback on how the saved value, based on the current response, will appear in the response value field.</p>
<p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_11879016516242.png" alt="Screenshot" width="850"></p>
<p>In the image above, the session parameter key is defined as "capital" and can be referenced within the dialogue builder using curly brackets - {{capital}}. The query determines which data should be transformed and saved as the value for the session parameter. In this case, it extracts the content from the "capital" field within the data object of the API response.</p>
<h3 id="h_01HAY9KGH13ZQSJHP7WF8MCX7K"><span style="color: #434343;">Query language - JSONata</span></h3>
<p>JSONata serves as the query language for both scenario-level and session parameter-level queries. It is designed with the principle that simple queries should be easy to write, making it accessible to both tech-savvy and non-tech-savvy professionals. JSONata features a shallow learning curve, allowing it to be quickly mastered. With JSONata, you can execute basic functions, transform dates, and even merge different data points together.</p>
<p><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_17178077806994.png" alt="Screenshot 2024-02-21 at 09.21.32.png" width="850"></p>
<p>JSONata is a publicly documented query and transformation language and the documentation can be found <a href="https://docs.jsonata.org/overview.html"><span class="wysiwyg-underline">here.</span></a> </p>
</div><p> </p>