Elarian JavaScript SDK
The wrapper provides convenient access to the Elarian APIs.
Documentation
Take a look at the API docs here.
Install
You can install the package from npm by running:
$ npm install elarian
Usage
const { Client, NumberProvider, MessagingChannel } = require('elarian');
const elarian = new Client({
apiKey: 'test_api_key',
appId: 'test_app'
});
elarian.sendMessage({
productId: 'product-j90HNs',
customerNumber: {
number: '+254700000000',
provider: NumberProvider.TELCO,
},
channelNumber: {
number: '41011',
channel: MessagingChannel.SMS,
},
body: {
text: {
text: 'Hello Boss'
}
}
})
.then(res => console.log(res))
.catch(ex => console.error(ex));
Methods
-
authToken()
:
-
getCustomerState()
:
-
adoptCustomerState()
:
-
addCustomerReminder()
:
-
addCustomerReminderByTag()
:
-
cancelCustomerReminder()
:
-
cancelCustomerReminderByTag()
:
-
updateCustomerTag()
:
-
deleteCustomerTag()
:
-
updateCustomerSecondaryId()
:
-
deleteCustomerSecondaryId()
:
-
updateCustomerMetadata()
:
-
deleteCustomerMetadata ()
:
-
sendMessage()
:
-
sendMessageByTag()
:
-
replyToMessage()
:
-
messagingConsent()
:
-
sendPayment()
:
-
checkoutPayment()
:
-
makeVoiceCall()
:
-
streamNotifications()
:
-
sendWebhookResponse()
:
Development
Run all tests:
$ npm install
$ npm test
Issues
If you find a bug, please file an issue on our issue tracker on GitHub.