Working with the Voximplant's API
VoxEngine allows developers to make Voximplant's Management API requests from within the scenario. For example, you can send an SMS message, or request a call history. Normally you can do one of these actions by calling one of Management API methods.
How to use
To make Management API requests from a scenario, first prepare your account:
- Generate a private API key in the Voximplant control panel. See Service accounts for more information.
- Bind the API key to the routing rule by calling the SetRuleInfo Management API method and specifying it in the
bind_key_id
parameter.
In the scenario, first require the VoximplantApi
module:
require(Modules.VoximplantApi);
And create the Voximplant.Client
instance:
const client = new VoximplantApi.Client();
Now you are ready to make a request from your scenario.
You can find the list of available requests in the API reference.
Request examples
Here you can find examples of how to perform management API requests from a scenario.
This example sends an SMS message containing a "Test message" text from the 447443332211 phone number to the 447443332212 phone number:
This example gets the first call session history record from the 2012-01-01 00:00:00 UTC to the 2014-01-01 00:00:00 UTC: