This guide explains how to extract AI output and the stream token from SnapCall for use with uGPT in Ultimate, so you can build further automations. The process has four main steps.
Collect the conversation id from the chat
First, get the conversation ID from the chat. Do this by adding an action to the first step of the bot configuration. If your flow already collects this parameter, skip to the next step.
Select any step, then click 'Add/Edit action' on the right side of the screen. A pop-up menu opens with a blue button at the top right. Click it to continue.
A pop-up window asks for a few settings. Set them up as shown below:
Set 'Target' to 'Sunshine conversation'
Set 'Action' to 'Get Conversation Metadata'
Set 'Field to retrieve' to 'id'
In the 'Save as parameter' field next to it, enter 'conversation_id'
Click 'Apply'
[keep existing screenshot]
Add SnapCall to your bot configuration (webview configuration)
Now that you have the conversation_id of the chat, you can give the end user a link to record a video or another type of media. You need a SnapCall account and a Public Page set up.
Once you've signed up with an upgraded workspace, go to Flow and create a new one. This lets you define which information SnapCall should process from the media using AI. It also gives you the Flow's unique link, which you'll find on the Flow list page. Add the following formula to the end of that URL, without spaces:
&ticket=smooch_{{conversation_id}}If your link doesn't contain a ? yet, use ?ticket= instead of &ticket=.
You can add the link in a webview, for example:
Select a 'Bot message' step in the flow where you want to add the webview, then click 'Add/Edit action' on the right side of the screen. A pop-up menu opens with a blue button at the top right. Click it to continue.
Fill in the remaining fields as shown in the image below.
[keep existing screenshot]
You can set the Message text, Fallback and Button text fields however you like. The URI field must contain the Flow link you copied earlier, including the formula above.
Wait for SnapCall to process and return AI output
When SnapCall receives media from the bot, it needs a few seconds to process the content and return the AI output to the bot as metadata. Once the output is ready, SnapCall adds a message to the conversation in a Free Text Written format.
When you configure your bot to let clients upload media through a webview, add a Free Text Written step immediately after the webview to account for this. You can also use this step to extract the SnapCall metadata, as shown below.
Collect SnapCall metadata
As in step 1, you'll now collect the output SnapCall provides and store it as variables, so you can use it later in your bot configuration.
When a user uploads media with SnapCall, SnapCall processes the AI output and stores it, along with the stream token, in the conversation metadata in the following format.
"conversation": { "id": "66fd6f243c410d8c9e000d2a", "type": "personal", "brandId": "18130750166290", "isDefault": true, "businessLastRead": "2024-10-02T16:05:41.759Z", "lastUpdatedAt": "2024-10-02T16:05:41.759Z", "createdAt": "2024-10-02T16:04:52.492Z", "metadata": { "userId": "66fd6f243c410d8c9e000d21", "origin_source_integration": "660ff11fe39567eab5704c85", "snapcall_stream_token": "<stream token value>", "snapcall_transcript": "Hello ?I've got an issue with my MacBook pro.The battery is not working anymore, and I can't use it, and i need to replace it.I want to know how I can perform that.Thanks for your", "snapcall_summary": "Here's the English translation of your request:- **I have a problem** with my MacBook Pro.- **The battery no longer works**, and I can't use it.- **I need** to replace it.- I want to know how I can get it replaced.", "snapcall_skill_{skillId}_{stepId}_{media1}": "The images show a desk setup with a closed laptop and a white keyboard in front. A red cable is placed on the laptop, and a screen displaying messaging applications is visible in the background." }, "activeSwitchboardIntegration": { "id": "660ff7c37ab96e947259a045", "name": "ultimate", "integrationId": "660ff7a9e4a711b885b41692", "integrationType": "ultimate" } } }The SnapCall metadata includes:
snapcall_stream_token: the stream token provided by SnapCall. [Add one sentence on what it's used for, or delete this placeholder.]
snapcall_transcript: the transcript of the recorded media.
snapcall_summary: a summary of the customer's request.
snapcall_skill_{skillId}{stepId}{media1}: the output of a specific AI skill. To collect AI outputs from a specific step in your SnapCall Flow, append
_1to the key of the value you want to extract, where1is the step number in the flow.
To store any of these as a variable, select any step after the webview you configured earlier in this article, then click 'Add/Edit action' on the right side of the screen.
A pop-up menu opens with a blue button at the top right. Click it to continue.
A pop-up window asks for a few settings. Set them up as shown below:
Set 'Target' to 'Sunshine conversation'
Set 'Action' to 'Get Conversation Metadata'
Set 'Field to retrieve' to '<Metadata>'
The 'Key' value depends on the variable you want to store. For example, to store the summary provided by SnapCall, enter 'snapcall_summary'. To store the stream token, enter 'snapcall_stream_token'.
In the 'Save as parameter' field next to it, enter a name for the variable, e.g. 'description' for the summary or 'stream_token' for the stream token
Click 'Apply'
Repeat this step for any other variable you want to store from SnapCall, such as 'snapcall_stream_token', 'snapcall_skill_{skillId}{stepId}{media1}' or 'snapcall_transcript'
You can now continue your configuration and use these variables like any other variables collected earlier or later in the flow.
