Voximplant API client library
Project description
Prerequisites
In order to use the Voximplant Python SDK, you need the following:
A developer account. If you don’t have one, sign up here.
A private API key.
To create it, 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).
Python 2.x or 3.x runtime with pip and setuptools>=18.5 installed
How to use
Go to your project folder and install the SDK using pip:
python -m pip install --user voximplant-apiclient
Then import the SDK in your script
from voximplant.apiclient import VoximplantAPI
Next, specify the path to the file with the result value either in the constructor or using the environment.
constructor:
api = VoximplantAPI("/path/to/credentials.json")
env:
export VOXIMPLANT_CREDENTIALS=/path/to/credentials.json
Examples
Start a scenario
from voximplant.apiclient import VoximplantAPI
if __name__ == "__main__":
api = VoximplantAPI("credentials.json")
# Start a scenario of the user 1
RULE_ID = 1
SCRIPT_CUSTOM_DATA = "mystr"
USER_ID = 1
res = api.start_scenarios(RULE_ID, script_custom_data=SCRIPT_CUSTOM_DATA, user_id=USER_ID)
print res
Send an SMS
from voximplant.apiclient import VoximplantAPI
if __name__ == "__main__":
api = VoximplantAPI("credentials.json")
# Send the SMS with the "Test message" text from the phone number 447443332211 to the phone number 447443332212
SOURCE = "447443332211"
DESTINATION = "447443332212"
SMS_BODY = "Test message"
res = api.send_sms_message(SOURCE, DESTINATION, SMS_BODY)
print res
Get a call history item
from voximplant.apiclient import VoximplantAPI
import pytz
import datetime
if __name__ == "__main__":
api = VoximplantAPI("credentials.json")
# 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
FROM_DATE = datetime.datetime(2012, 1, 1, 0, 0, 0, pytz.utc)
TO_DATE = datetime.datetime(2014, 1, 1, 0, 0, 0, pytz.utc)
COUNT = 1
res = api.get_call_history(FROM_DATE, TO_DATE, count=COUNT)
print res
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for voximplant-apiclient-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f1a6ce3f7736539e4743aae076ce749d024d338bceec3246fc0032e5bbf6708 |
|
MD5 | cde90f1759b7c6cf6b93cc469ead070d |
|
BLAKE2b-256 | b8462f35f4c311192f3e20d195872244a20ca6a9dbf42046f118fc5b7b3b167d |
Hashes for voximplant_apiclient-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15c1f71e1d7c01f5ff72a8fba83fcbfd1056ecfbddb09ed6f82231762b4655f8 |
|
MD5 | 891ecb4b472c9cf73ed37c409671964e |
|
BLAKE2b-256 | 7e8acf16b8dc0a3d3dc23bf01990336bcddc661b746fc44ad13efe5c759a011d |