Coder Social home page Coder Social logo

symblai / symbl-web-sdk Goto Github PK

View Code? Open in Web Editor NEW
7.0 6.0 5.0 3.27 MB

Symbl's Web SDK for bringing conversation intelligence in Web apps or any browser-based application.

License: Apache License 2.0

JavaScript 0.40% TypeScript 99.60%
websdk browser intelligence conversation topic websocket streaming live

symbl-web-sdk's Introduction

Symbl Web SDK

Quality Gate Status

You can read the docs for the Symbl Web SDK at https://docs.symbl.ai/docs/web-sdk/overview

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

The Web SDK is a Typescript application that allows you to add Symbl’s Conversation Intelligence into your JavaScript application directly into the browser. It provides a pre-defined set of classes for easy utilization of our Streaming and Subscribe APIs.

The Web SDK is currently available with Symbl’s Streaming and Subscribe APIs.

Supported Browsers

The following web browser supported with the Web SDK are given below:

Operating System Chrome Edge Firefox Safari
macOS -
Windows -
Linux - -

Prerequisites

Before using the Web SDK you must Sign up with Symbl.ai to generate your own App ID and App Secret values, which is used for authentication.

Installation

Using npm

Install the Web SDK using npm with the following command:

npm i  @symblai/symbl-web-sdk

CDN

You can also import the file into your HTML appliaction using our CDN.

Versioned CDN

<script src="https://sdk.symbl.ai/js/beta/symbl-web-sdk/v1.0.5/symbl.min.js"></script>

Latest CDN

<script src="https://sdk.symbl.ai/js/beta/symbl-web-sdk/latest/symbl.min.js"></script>

You would then access the Symbl class via the window method:

const Symbl = window.Symbl;
const symbl = new Symbl({
  accessToken: "< YOUR ACCESS TOKEN >"
});

For production environments we recommend using the Versioned CDN.

Importing

You can import the Web SDK in via Browser, ES5 and ES6 syntax:

ES6

import {Symbl} from '@symblai/symbl-web-sdk';

ES5

const {Symbl} = require('@symblai/symbl-web-sdk');

Browser

const {Symbl} = window;

Authentication

To initialize the Web SDK, you can pass in an access token generated using Symbl’s Authentication method. Alternatively, you can use the App ID and App Secret from the Symbl Platform. Using the App ID and App Secret is not meant for production usage, as those are meant be secret.

The code given below initializes the Web SDK:

const symbl = new Symbl({
    accessToken: '<your Access Token>'
    // appId: '<your App ID>', // Should only be used for development environment
    // appSecret: '<your App Secret>', // Should only be used for development environment
    // basePath: '<your custom base path>',// optional
    // logLevel: 'debug' // Sets which log level you want to view
});

Getting Started

In order to get started with the Symbl Web SDK we will start with a basic Hello World implementation

Example

The following example opens a WebSocket connection with the Symbl Streaming API and starts processing audio data from the default input device (microphone). After 60 seconds this sample code stops audio processing and closes the WebSocket connection.

View the Importing section for the various ways to import the Web SDK.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Symbl Web SDK example</title>
  <script src="https://sdk.symbl.ai/js/beta/symbl-web-sdk/latest/symbl.min.js"></script>
  <script>
    const start = async () => {


      try {

          // Symbl recommends replacing the App ID and App Secret with an Access Token for authentication in production applications.
          // For more information about authentication see https://docs.symbl.ai/docs/developer-tools/authentication/.
          const symbl = new Symbl({
              appId: '<your App ID>',
              appSecret: '<your App Secret>',
              // accessToken: '<your Access Token>' // for production use
          });
          
          // Open a Streaming API WebSocket Connection and start processing audio from your input device.
          const connection = await symbl.createAndStartNewConnection();

          // Retrieve real-time transcription from the conversation.
          connection.on("speech_recognition", (speechData) => {
            const name = speechData.user ? speechData.user.name : "User";
            const transcript = speechData.punctuated.transcript;
            console.log(`${name}: `, transcript);
            document.querySelector("#speechRecognition").innerHTML = `${name}: ${transcript}`;
          });
          
          // This is a helper method for testing purposes.
          // It waits 60 seconds before continuing to the next API call.
          await Symbl.wait(60000);
          
          // Stops processing audio, but keeps the WebSocket connection open.
          await connection.stopProcessing();
          
          // Closes the WebSocket connection.
          connection.disconnect();
      } catch(e) {
          // Handle errors here.
      }
    }
  </script>
</head>

<body>

  <button onclick="javascript: start()">Start Processing</button>

  <p id="speechRecognition">Click <b>Start Processing</b> and begin speaking to see transcription. If prompted, allow access to your microphone. <br> <br> If nothing happens, check your <a href="https://platform.symbl.ai/#/home">Symbl App ID and App Secret</a> in this HTML file on lines 16 and 17 respectively.</p>

</body>

</html>

Read more

You can read the docs for the Symbl Web SDK at https://docs.symbl.ai/docs/web-sdk/overview

Known Issues

The current version of the Web SDK includes a few Known Issues. You can also keep track of these issues as they are addressed via the Issues tab of the github repo.

symbl-web-sdk's People

Contributors

arjun-09 avatar avoliva avatar chinnaatsymbl avatar mahesh-symbl avatar mjabali avatar nischaysymblai avatar siddharth-symbl avatar stokes-christopher avatar subodhjenasymbl avatar symbl-ay avatar symbldoc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

symbl-web-sdk's Issues

how to set the input language?

how to set the input language?

   const id = "asidjf23sdf";

            const connectionConfig = {
                "config": {
                    "confidenceThreshold": 0.7,
                    "languageCode": "nl-NL",
                    "meetingTitle": "My Test Meeting",
                    "timezoneOffset": 480
                },
                id,
                "insightTypes": [
                    "action_item",
                    "question"
                ],
                "speaker": {
                    "name": "My name",
                    "userId": "emailAddress"
                }
            };

            const connection = await symbl.createAndStartNewConnection(connectionConfig);

            connection.on('speech_recognition', (speechData) => {
                const name = speechData.user ? speechData.user.name : 'User';
                const transcript = speechData.punctuated.transcript;
                setTranscribedText(transcript); // Make sure this function is defined
            });

logLevel not currently setting.

Users should be able to pass in the log level with the SymblConfig in the Symbl constructor. This is not currently supported..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.