Getting started with Real-Time Assist (RTA) API
To get started with RTA API, there are two essential steps - setup, and real time streaming integration.
RTA Setup
Step 1: Authentication
Start by generating an access token using your appId and appSecret from the Symbl.ai platform.
curl --location 'https://api.symbl.ai/oauth2/token:generate' \
--header 'Content-Type: application/json' \
--data '
{
"type": "application",
"appId": "your appId",
"appSecret": "your appSecret"
}'
This request will return an access token, which is required for all subsequent API calls.
Step 2: Create an RTA
Next, create an RTA instance with relevant details, such as the name and description. The description field should clearly outline your objectives for the assist and describe what you aim to achieve with the real-time assist.
curl --location 'https://api.symbl.ai/v1/manage/rta' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your_access_token' \
--data '{
"name": "RTA for customer support",
"description": "Real-Time Assist for customer support team A"
}'
Step 3: Configure Objection Handling Assistant
To configure the objection-handling assistant for your RTA, select the specific objections you want to detect in real-time. Symbl.ai detects objections using its intent-detection engine called Trackers.
Step 3.a: Add Trackers to Your Trackers Library
You can create custom trackers based on the specific objections you want to detect or use any of the 16 predefined Objections trackers available in Symbl.ai’s managed trackers library.
You can either create custom trackers based on specific objections you want to detect or use any of the 16 predefined Objections Trackers available in Symbl.ai’s managed trackers library.
- Managed Trackers: The managed Objections Trackers are pre-created and tested by Symbl.ai, making them an ideal starting point for setting up the objection-handling assistant. Log in to the Symbl.ai platform to add these managed trackers to your trackers library.
- Custom Trackers: You can create custom objections by developing custom trackers and tagging them with the “Objections” category. Ensure that the description for the custom tracker is accurate and detailed, as this enhances real-time detection accuracy.
For more information, refer to the Trackers documentation.
Step 3.a: Link Trackers/Objections with RTA
Retrieve the IDs of the trackers you want to use in your RTA session by making an API call:
curl --location 'https://api.symbl.ai/v1/manage/trackers' \
--header 'Authorization: Bearer your_access_token'
This will return a list of tracker IDs that you can then use to set up objections in your RTA instance.
Now, configure the objection-handling assistant using the fetched tracker IDs.
curl --location 'https://api.symbl.ai/v1/manage/rta/{rta_id}/assistants/objection-handling' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your_access_token' \
--data '{
"trackerId": [
"5629713285906432", // Replace with your tracker IDs
"5650867249741824",
"5652153256902656",
"5662580430864384"
]
}'
This step configures the RTA to detect the defined objections during a live conversation and respond accordingly.
Real-Time Streaming Integration
After setting up your RTA configuration, stream your real-time conversation via WebSocket using the RTA API to get detected objections.
Step 1: Stream real-time conversation
Here’s a sample script to start a WebSocket streaming connection with the RTA API:
Steps to execute the script -
- Copy and paste the script into your preferred editor.
- Update
SYMBL_ACCESS_TOKEN
with your access token. - Update user data such as email, userId, name, and role in the conversation. The role can be either “
agent
” or “customer
.” Use the "agent
" role when acting as the agent and the "customer
" role when acting as the customer. - A
realtimeSessionId
is generated when the agent first initiates a streaming session. Use this same sessionId on the customer side to connect to the shared session. - Update the
RTAId
with theRTAId
created in Step 2 of the previous section. - Save the script as
app.js
and execute it usingnode app.js
. Once successfully connected, the transcript_response will be logged as you start speaking.
var WebSocketClient = require('websocket').client;
const uuid = require('uuid').v4;
const mic = require('mic');
const micInstance = mic({
rate: '44100',
channels: '1',
debug: false,
exitOnSilence: 30,
});
const micInputStream = micInstance.getAudioStream();
const user = {
email:"[email protected]",//your email
userId: "ABCDEF999",//your userId
name: "ABC",
role: "agent"// or customer
};
const realtimeSessionId = uuid();
console.log(realtimeSessionId);
const SYMBL_ACCESS_TOKEN = 'Your Access Token';
const symblEndpoint= 'wss://api.symbl.ai/v1/realtime/assist/' + realtimeSessionId + '?accessToken=' + SYMBL_ACCESS_TOKEN;
var client = new WebSocketClient();
client.on('connectFailed', function(error) {
console.log('Connect Error: ' + error.toString());
});
client.on('connect', function(connection) {
console.log('WebSocket Client Connected');
try {
micInstance.start();
} catch (e) {
console.log(e)
}
connection.on('error', function(error) {
console.log("Connection Error: " + error.toString());
});
connection.on('close', function() {
console.log('echo-protocol Connection Closed');
});
connection.on('message', function(message) {
if (message.type === 'utf8') {
//const msg = JSON.parse(message.utf8Data); //if you want to see live transcript uncoment this
// Only print messages with type 'objection_response' or 'transcript_response'
if (msg.type === 'objection_response' || msg.type === 'transcript_response') {
console.log(JSON.stringify(msg, null, 2));
}
if(msg.message && msg.message.type === 'recognition_started') {
micInputStream.on('data', (data) => {
connection.send(data);
});
}
}
});
connection.send(JSON.stringify({
type: 'start_request',
id: realtimeSessionId,
RTAId:"your RTA Id",
config: {
speechRecognition: {
sampleRateHertz: 44100,
},
},
speaker: user,
assistants:["objection-handling"],
}))
});
client.connect(
symblEndpoint,
'ws',
null,
null,
{ 'x-api-key': SYMBL_ACCESS_TOKEN, rejectUnauthorized: false }
);
Step 2: Detect Objections in Real-Time
The API will start detecting objections in real-time and provide relevant responses to guide your agents. Use the following code snippet to log detected objections. When an objection is detected in real-time, you'll receive an objection_response
containing the detected objection and the message from which it was identified.
connection.on('message', function (message) {
const msg = JSON.parse(message.utf8Data);
if (msg.type === 'objection_response') {
console.log("Objection Detected: ", JSON.stringify(msg, null, 2));
}
});
Here is the sample objection response:
{ type: 'objection_response',
payload:
{ name: 'Symbl.Competitor_Objection',
message:
'Well, I've heard that luxaderme is actually the best brand out there.'
}
}
Note: Currently the RTA API supports objection detection. Response generation will be available soon.
Updated 4 months ago