Establishing a Connection

Interactive Tutorials are currently not supported on mobile devices. To ensure an enhanced experience, kindly access this tutorial from a laptop/desktop browser instead.

Elarian is a customer engagement framework that makes it easy to build resilient, feature-full applications fast! Out of the box, Elarian provides you communications, payments, storage, reminders, and analytics infrastructure. This infrastructure is provided as a service that you interact with programmatically.

To connect to Elarian, you'll need to install one of our official SDKs, but we'll be doing everything from within the browser for these tutorials; no installation required for now 😎

Next, you'll need an orgId, appId, and apiKey, which you can get from your dashboard. If you haven't signed up yet, you can do so here, and these values will be available by default.

Get your orgId

Get your appId

Get your apiKey

Once you have your connection variables, import the Elarian SDK and establish a connection like this:

const { Elarian }  = require('elarian');

const client = new Elarian({
  orgId: 'YOUR-ORG-ID',
  appId: 'YOUR-APP-ID',
  apiKey: 'YOUR-API-KEY',
});

client
  .on('connected', () => {
    console.log('App is connected');
  })
  .on('error', (error) => {
    console.log('Connection failed -> ', error);
  })
  .connect();

Go ahead and run this code in the IDE to your right, and if all is well, there should be a successful connection message logged on the console.

You've now established a persistent bi-directional connection to Elarian that you can use to send and receive data. The connection is also resilient as the SDK automatically handles reconnection if the link is dropped.