Consume Trackers with Streaming API (Archived)

🚧

This content is outdated

This content is from an older version of the Symbl.ai documentation. We recommend you use the latest version at Trackers

🚧

In Beta

This feature is in Beta. If you have questions or comments, email [email protected].

To pass a Tracker in the Streaming API, use the config object.

The following example shows how to pass Trackers in the config object for the startRealtimeRequest of the Symbl JavaScript SDK. This example also shows how to consume the results of the detected Trackers in real-time.

Using Enable All Trackers functionality

Additionally, you can pass the parameter enableAllTrackers in the config object for trackers to use all the Trackers linked to your Symbl account. See the following example for details about how to pass this parameter.

📘

Best Practices

Before creating the Trackers, go through the Best Practices document to learn about the dos and don'ts of the Tracker vocabulary creation.

Authentication

Before using the API, ensure that you have your Authentication Token (AUTH_TOKEN) handy. To learn about how to get your auth token, see the step-by-step instructions on the Authentication page.

Sample Request

const connection = await sdk.startRealtimeRequest({
    id,
    insightTypes: ['action_item', 'question'],
    trackers: [
        {
            name: "Promotion Mention",
            vocabulary: [
                "We have a special promotion going on if you book this before",
                "I can offer you a discount of 10 20 percent you being a new customer for us",
                "We have our month special this month",
                "We have a sale right now on"
            ]
        }
    ],
    config: {
        meetingTitle: "My Meeting",
        confidenceThreshold: 0.7,
        languageCode: "en-US",
        sampleRateHertz: 48000,
        trackers: {
            "interimResults": true,
            "enableAllTrackers": true
        }
    },
    speaker: {
        // Optional, if not specified, will simply not send an email in the end.
        userId: "[email protected]", // Update with valid email
        name: "John",
    },
    handlers: {
        onTrackerResponse: (data) => {
            // When a tracker is detected in real-time
            console.log('onTrackerResponse', JSON.stringify(data, null, 2));
            if (!!data) {
                data.forEach((tracker) => {
                    console.log(`Detected Tracker Name: ${tracker.name}`);
                    console.log(`Detected Matches`);
                    tracker.matches.forEach((match) => {
                        console.log(`Tracker Value: ${match.value}`);
                        console.log(`Messages detected against this Tracker`);
                        match.messageRefs.forEach((messageRef) => {
                            console.log(`Message ID: ${messageRef.id}`);
                            console.log(`Message text for which the match was detected: ${messageRef.text}`);
                            console.log(`\n`);
                        });
                        console.log(`\n\n`);
                        
                        console.log(`Insights detected against this Tracker`);
                        match.messageRefs.forEach((insightRef) => {
                            console.log(`Insight ID: ${insightRef.id}`);
                            console.log(`Insight text for which the match was detected: ${insightRef.text}`);
                            console.log(`Insight Type: ${insightRef.type}`);
                            console.log(`\n`);
                        });
                        console.log(`\n\n`);
                    });
                });
            }
        },
    },
})

Parameter Description

Let’s go over all the parameters passed in the configuration object in the above function:

FieldRequired
idA unique UUID that represents this WebSocket API Session.
insightTypeThe types of Insights to be detected for this Conversation.
trackersThe Trackers to be detected in real-time for that Conversation. Follows the same structure as described in the Trackers section.
configThe config object encapsulates the metadata for the WebSocket API’s session.
meetingTitleThe title for this conversation/meeting.
confidenceThresholdThe insights having confidence scores greater than this threshold will be the ones detected for the Conversation.
languageCodeThe language-code in BCP-47 format.
sampleRateHertzThe sample-rate of the incoming audio data which is being pushed to Symbl.
trackers.interimResultsThe interimResults flag tells Symbl to send the tracker results as soon as they are detected. If false, the tracker results are detected for the finalized transcription responses.
trackers.enableAllTrackersThe enableAllTrackers parameter must be sent to detect all the Trackers. The purpose of this flag is to enable detection of all the Trackers created with the Management API that maintains your entities with Symbl at the account level.
speakerThe details of the speaker in this Conversation
userIdUnique identifier to represent the User.
nameThe name of the User.
handlersThe object encapsulating the call-back functions to be invoked on detection of those specific entities. For more information on various such handlers, check out this link.
onTrackerResponseThis function is invoked when Symbl detects a Tracker in real-time. The structure of the Tracker object is shown in the above code snippet.

Response

"trackers":[
      {
         "name":"Testing Tracker Dev User 75",
         "matches":[
            {
               "type":"vocabulary",
               "value":"Documents",
               "messageRefs":[
                  {
                     "id":"53867534-0459-4d22-b590-984ee82166aa",
                     "text":"Anyways, so I will submit documents tomorrow.",
                     "offset":26
                  },
                  {
                     "id":"4d20d90c-50a7-4594-bb10-2995dcd4bbd1",
                     "text":"I will submit documents tomorrow.",
                     "offset":14
                  }
               ],
               "insightRefs":[
                  {
                     "id":"4d20d90c-50a7-4594-bb10-2995dcd4bbd1",
                     "text":"James needs to submit documents tomorrow.",
                     "type":"action_item",
                     "offset":22
                  }
               ]
            }
Field NameDescription
nameThe name of the Tracker detected
matchesArray of match objects which contain the references to messages and insights detected in that conversation.
typeThe match type for the text. In the above example, the match is of type vocabulary.
valueThe textual value of the vocabulary for which this match was detected.
messageRefsArray of messages for which this Tracker was detected.
messageRefs.idThe unique identifier of the message.
messageRefs.textThe text body of the message.
messageRefs.offsetThe closest match of the text in the message. Offset of -1 means that an exact match for that specific vocabulary wasn’t found and this was the similar match. An offset greater than 0 indicates an exact match for the tracker in the payload of the message.

Related Documents

Trackers Tutorials (Archived):

Reference:


Did this page help you?