JavaScript SDK

When running the examples you will be asked to sign in with a Circuit sandbox account. You can register for a free account on the Circuit Portal.

API Documentation Github

Teaser example to logon and fetch conversations:

// Create the client with the client_id (aka app key), scope and optionally a redirect_uri
var client = new Circuit.Client({
  client_id: 'your client_id',
  scope: 'READ_USER_PROFILE,READ_CONVERSATIONS'
});

// Logon with OAuth2, then retrieve the logged on user's conversations
client.logon()
  .then(user => console.log('Successfully authenticated as ' + user.displayName))
  .then(client.getConversations)
  .then(conversations => conversations.forEach(c => console.log(c.convId)))
  .catch(console.error);
                        

See OAuth 2.0 for information on how to register an app.

JS Bin examples

Short examples demonstrating one or more particular APIs. You can view the source, or clone your own JS Bin using the link at the top right of the live example. A sandbox account is required to run the live examples. JS Bin examples use OAuth 2.0.

Live Example Description
Direct call Start a direct call with another Circuit user. Toggle own video and ability to enable HD Video.
Retrieve Threads and Comments Retrieve 25 most recent conversations and display them in a list. When selecting a conversation, retrieve their 50 most recent threads and display them in a list. When selecting a thread, show the 20 most recent comments.
Create conference bridge Create a new conversation for a conference bridge, gets the conference details and waits for participants to join. Once other participants join the audio conference is established. No video in this example.
Disable remote audio Lookup active conferences, then join first one and disable the incoming audio stream.
Send user to user message Start a direct call with a user initiated on one of your other devices. Also called Click-2-Call. Opens a new browser tab in case user is not logged on the another web-based client.
Incoming telephony call Demonstrates the telephony APIs. Answer a telephony (ATC/UTC) call, move call to another device, pull call back, listen to telephony events.
Moderation Creates a conversation, turns on moderation and grants other user moderator rights.
Join a conference on a different device Find started conferences in conversations user is a member of and list them. Then allow user to join one of the conferences on another of the user's devices.
Mute mic/speaker of webclient Lookup active call on webclient, then mute mic and speaker for that call on that webclient.
Start a call from Circuit webclient Start a direct call with a user initiated on one of your other devices. Also called Click-2-Call. Opens a new browser tab in case user is not logged on the another web-based client.
Search a favorited user using fuzzy search Search a user by its name using fuse.js for fuzzy search.
OAuth 2.0 Client Credentials Grant Testing login and auto token renewal for OAuth 2.0 Client Credentials Grant. Client Credentials Grant should ONLY be used by server side applications such as Node.js BOTs.

Github examples

The source code of the examples below are on github and are hosted on rawgit.


Circuit-like web-app

Circuit-like app built with vue.js and Circuit JS SDK. Showcases several different APIs. RTC APIs still to be added.

Live example Source
Introduction example

Logon using OAuth2, read most recent conversation. Defines injectors and shows conversation with extended injector attributes. Listens to various events.

Live example Source
Group Call: video and screenshare

This example shows how to start, join or leave a conference call. Also allows to toggle video or screenshare. For screenshare the Circuit SDK Chrome Extension is required.

Live example Source
Complete Messaging Examples (AngularJS)

Shows complete messaging functionality. Allow to select a conversation to send a message to, upload files, or create a new conversation.

Live example Source
Direct Call: audio and video

This example shows how to start an audio/video direct call, or auto accept an incoming call.

Live example Source
Telephony (PSTN) call

Make outgoing phone calls to any regular telephone. Telephony Connector needs to be setup for your tenant.

Live example Source
Add participant to call

Start a conference and dial out either a PSTN number, a Circuit user, or ring all conversation members.

Live example Source
Share HTML5 Canvas

This example shows a schematic in a HTML5 canvas and allows drawing on top of it and shares the combined image in the call. The application can use the new HTMLCanvasElement.captureStream API available in Chrome and Firefox to capture a stream from a canvas. Note that Chrome has an issue with compression which causes WebRTC to reduce the resolution, or not even show the drawing. Use FireFox in the meantime.

Live example Source