npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@symblai/symbl-web-sdk

v1.0.14

Published

Symbl.ai Web SDK for accessing Symbl.ai APIs directly from the web browser.

Downloads

574

Readme

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.