Quick start : Js API : Start using ApiRTC

You can find here the first steps to start using apiRTC. A good starting point is also to look at our tutorials where we have describe in details the different feature integration.

Create your Apizee account to get your apiKey

Apikey is used to authentify your account and isolate your users. Create your account on our dasboard using following link : GET AN ACCOUNT

Load apiRTC library in your application

Latest and adviced apiRTC version is available on our servers: 4.1 - [https://cloud.apizee.com/apiRTC/v4.1/apiRTC-latest.min.js](https://cloud.apizee.com/apiRTC/v4.1/apiRTC-latest.min.js)

Include lib in your application using foolowing script:

    <script type="text/javascript" src="https://cloud.apizee.com/apiRTC/v4.1/apiRTC-latest.min.js"></script>

Create your User Agent

First of all, you need to create a User Agent.

User Agent is the starting point of apiRTC and enable you to manage several important aspects such as :

For a complete description of User Agent possibility, check our detailled User Agent tutorials and API reference

In this quick start, we create a User Agent using apiKey :

    var ua = new apiRTC.UserAgent({
        uri: 'apzkey:[put apiKey here]'
    });

Register your User Agent

In order to start communicating with other users, User Agent has to register to the Apizee platform. ApiKey is used to isolate your project so you will be able to communicate with users that are registered with the same apiKey.

    ua.register({
        id : 1 // OPTIONAL // This is used for setting userId
    }).then(function (session) {
        // ok
        console.log("Registration OK");
        connectedSession = session;
    }).catch(function (error) {
        // error
        console.log("Registration error");
    });

Start communicating

ApiRTC integrate a Contact management to facilitate the communication with other users. Contacts are automatically created on apiRTC depending of user presence or enterprise directory.

When connected, you can start communicating with other connected User Agent in the same Apizee enterprise. As an example, to send a chat message, simply call the Contact#SendMessage() function :

    let userAgentId_2 = "Your contact userId";
    let contact = session.getContact(userAgentId_2);
    if (contact !== null) {
        contact.sendMessage("Hello");
    }

Build your own application

You are now ready to start your own apiRTC based application.

Check our tutorials and API reference to use all our integrated feature.