Twilio

🚧

Migration to new JavaScript Bridge Interface

We have made it easier for you to interact with Twilio via the GoNative JavaScript Bridge.

Previously, you would call the bridge using:
window.location.href = 'gonative://twilio/video/join?key=value'

Now you can do the same using:
gonative.twilio.video.join({key: value});

Overview

Add a native Twilio video chat interface to your app to provide your users a more seamless and integrated experience versus a web-based client.

Implementation Guide

Once the premium module has been added to your app, you may use the following GoNative JavaScript Bridge commands to access its functionality.

To join a video call, define a callback function in javascript, for example:

function twilio_callback(data) { 
    if (data.error) {
        console.log('Twilio Error: ' + data.error);
    } else if (data.status) {
        console.log('Twilio Status: ' + data.status);
    }
}

↔️GoNative JavaScript Bridge

Then run the following javascript function, passing in the name of your callback function along with other params displayName, token and identity.

// This command returns a promise if 'callback' is passed
gonative.twilio.video.join({'displayName': 'room', 'token': 'token', 'identity': 'identity', 'callback': twilio_callback});

Details of the query params:

  • displayName: The name of the video call room to join.
  • identity: The name that will be shown on the video call room for the user joining the room.
  • token: The Access Token received from Twilio after authenticated with Twilio. For more information about how to obtain the access token: Twilio API: Access Tokens

Tip: Some JS Bridge commands return promises. They are usually declared as such through a comment to help you identify them. Learn More.