Skip to content

Cordova Getting Started

ConnectyCube Cordova SDK is a development kit that enables an easy and fast integration of chat, voice & video calling, user authorization, file attachments, push notifications and many other into client apps. No server side implementation required. You fully concentrate on your mobile app development.

If you are looking to build a newly app, we recommend you build a client app on top of our code samples apps. If you already have an app and you are looking to add chat and voice & video calling to it, proceed with this guide. This guide walks you through installing the ConnectyCube SDK in your app, configure it and then sending your first message or initiate a first call.

Before you start

Before initializing ConnectyCube SDK, you need to create a ConnectyCube application on ConnectyCube Dashboard:

  1. Register an account at https://connectycube.com/signup. If you already have a ConnectyCube account, sign into your account.
  2. Create a new application and obtain credentials (Application ID, Auth Key, Auth Secret).

Get started

To use chat and calling in a client app, you should install, import and configure ConnectyCube SDK.

Install SDK

Сonnect SDK js file as a normal script:

<script src="https://cdn.jsdelivr.net/npm/connectycube/dist/connectycube.min.js"></script>

Initialize SDK

Initialize the SDK with your ConnectyCube application credentials. You can access your application credentials in ConnectyCube Dashboard:

const CREDENTIALS = {
appId: 21,
authKey: 'hhf87hfushuiwef',
authSecret: 'jjsdf898hfsdfk',
};
ConnectyCube.init(CREDENTIALS);
Initialize SDK with existing token

It can be a scenario when you might want to create a ConnectyCube session token outside of the app code, e.g. to incorporate this logic at your custom backend server.

In this case, there is a way to initialize SDK by existing ConnectyCube session token:

const CREDENTIALS = {
appId: 21,
token: "5a7bc95d85c0eb2bf052be3d29d3df523081e80y",
};
ConnectyCube.init(CREDENTIALS);

Also, there can be another use case when a developer wants to preserve the session between browser page refreshes.

In this case, a session can be stored to e.g. local storage and then can be restored and passed to SDK, so you do not need to re-create a new one if the session is still valid:

const storedSession = localStorage.getItem("ConnectyCube:session");
const session = JSON.parse(storedSession);
ConnectyCube.setSession(session);
Configure SDK

An additional set of configs can be passed as a 2nd argument in init function:

const CONFIG = {
debug: { mode: 1 }, // enable DEBUG mode (mode 0 is logs off, mode 1 -> console.log())
};
ConnectyCube.init(CREDENTIALS, CONFIG);

Default configuration

Integrate chat and voice/video calling features

Follow the API guides on how to integrate chat and calling features into your app: