Skip to main content

[Zendesk] Analyze Native Upload Attachments with Advanced AI Agent

Alessandro Angioni avatar
Written by Alessandro Angioni
Updated this week

If you receive a large number of attachments from customers through your Zendesk Messaging widget and want to analyze them and build conditions based on their content, you can leverage SnapCall AI features even if customers do not upload media through a webview. Customers only need to upload files using the attachment feature; the file will then be forwarded to SnapCall, which will return the AI results within the conversation metadata.

The use case can be summarized as follows:

  • On the bot configuration (Advanced AI agent), you can prompt the customer to attach a file using an AI agent message step

  • After that, you must define a “Free text written” step so the customer has time to upload the media

  • An API call configured in your bot will send the media URL to SnapCall, allowing you to retrieve the AI output

  • SnapCall will respond with a “Free text written” step once the AI output is available; at this step, you can extract all results from the conversation metadata

The configuration can be summarized as follows:


Step 1: Create an API connection

In the Advanced AI agent, immediately after logging in, navigate to “API integration” on the left-hand menu, then click the blue “Add integration” button. You can now start configuring the API integration as outlined below:

  • The API integration name can be set as you wish, and you may optionally add a description for future reference

  • In the Request parameters tab, define the variables attachment_url and conversation_id, which will later be extracted in the bot flow

  • Under Environment, select Production and configure the required parameters. Set the method to POST and use the following URL:
    https://api.snapcall.io/v2/streams/events/upload-url
    No authorization is required at this stage

  • On the same screen, open the Headers tab. Define the key as Authorization and the value as Bearer YOUR_SNAPCALL_API_KEY. You can find your API key by logging into your SnapCall workspace as an administrator.

  • Now define the body of the API integration. On the third sub tab on the same screen, add the following body on the dedicated space

    {

    "companyId": YOUR_COMPANY_ID,

    "url": "{{attachment_url}}",

    "ticket": "smooch_{{conversation_id}}",

    "flowToken": "YOUR_FLOW_ID"

    }


    The flow ID is the last variable of any SnapCall Flow you set up earlier, while the company ID is a 4/5 digits code that you can find here.


Step 2: Define an entity

We will now create an entity to extract the attachment URL when the customer uploads anything using the native upload feature.

  • On the Advanced AI agent main menu, look for Entities under 'Content'. Once located, create a new Entity using the dedicated button on the top right side of the screen

  • Name and description of the entity can be whatever you want, then set the 'Rule type' as Regular expression

  • Add the following formula on the field just below: \bhttps:\/\/\S+\.zendesk\.com\/attachments\/token\/\S+\b

Now that you have both an API integration and an entity, you're ready to configure the bot.


Step 3: configure your bot

Now that we configured both an entity and an API integration, we're ready to configure the bot itself. In this case, the most important things to define on the Flow are the following.

  1. You need to extract the ID of the conversation within any step of your bot flow, we recommend doing this at the very first step. Head here to learn how to do it.

  2. After prompting the customer to upload anything, add a 'Free Text Written' step and use the entity defined earlier to extract the attachment URL at that specific step.

  3. Just after that you'll have to use the API integration defined earlier, as you now have both the conversation_id as well as the attachment url. The first variable will tell SnapCall in which conversation the AI output need to be added.

  4. Add another 'Free text written' step, so that the flow can be ''paused'' until SnapCall provides the AI outputs. You should have an outcome similar to the one below.

  5. Once everything is configured, save changes and activate it.

Did this answer your question?