4.0.0 • Published 3 months ago
@voximplant/apiclient-nodejs v4.0.0
Voximplant API client library
Version 2.0
Prerequisites
In order to use Voximplant Node.js SDK, you need the following:
- A developer account. If you don't have one, sign up here.
- A private API key. There are 2 options to obtain it:
- Generate it in the Voximplant Control panel
- Call the CreateKey HTTP API method with the specified authentication parameters. You'll receive a response with the result field in it. Save the result value in a file (since we don't store the keys, save it securely on your side).
- Node.js >= 11
How to use
Go to your project folder and install the SDK using npm
:
npm i --save @voximplant/apiclient-nodejs
Then import the SDK in your script
const VoximplantApiClient = require('@voximplant/apiclient-nodejs').default;
Next, specify the path to the file with the result value either in the constructor or using the environment.
constructor:
const client = new VoximplantApiClient('/path/to/credentials.json');
env:
export VOXIMPLANT_CREDENTIALS=/path/to/credentials.json
Examples
Start a scenario
const VoximplantApiClient = require('@voximplant/apiclient-nodejs').default;
const client = new VoximplantApiClient();
client.onReady = function () {
// Start the scripts from the account.
client.Scenarios.startScenarios({ ruleId: '1', scriptCustomData: 'mystr' })
.then((ev) => console.log(ev))
.catch((err) => console.error(err));
};
Send an SMS
const VoximplantApiClient = require('@voximplant/apiclient-nodejs').default;
const client = new VoximplantApiClient();
client.onReady = function () {
// Send the SMS message with text "Test message" from the phone number 447443332211 to the phone number 447443332212.
client.SMS.sendSmsMessage({
source: '447443332211',
destination: '447443332212',
smsBody: 'Test message',
})
.then((ev) => console.log(ev))
.catch((err) => console.error(err));
};
Get a call history item
const VoximplantApiClient = require('@voximplant/apiclient-nodejs').default;
const client = new VoximplantApiClient();
client.onReady = function () {
// Get the first call session history record from the 2012-01-01 00:00:00 UTC to the 2014-01-01 00:00:00 UTC
client.History.getCallHistory({
fromDate: new Date('2012-01-01 00:00:00 GMT'),
toDate: new Date('2014-01-01 00:00:00 GMT'),
count: '1',
timezone: 'Etc/GMT',
})
.then((ev) => console.log(ev))
.catch((err) => console.error(err));
};
4.0.0
3 months ago
3.4.0
3 months ago
3.3.0
5 months ago
3.2.0
6 months ago
3.1.0
6 months ago
2.12.0
9 months ago
3.0.0
9 months ago
2.11.0
10 months ago
2.10.0
1 year ago
2.9.0
1 year ago
2.8.0
1 year ago
2.7.0
1 year ago
2.6.0
1 year ago
2.5.0
1 year ago
2.4.0
2 years ago
2.3.0
2 years ago
2.2.0
2 years ago
2.1.0
2 years ago
2.0.5
3 years ago
2.0.4
3 years ago
2.0.3
4 years ago
2.0.2
4 years ago
2.0.1
4 years ago
2.0.0
4 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago
0.0.4
6 years ago
0.0.3
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago