Skip to main content

Prerequisites

In order to use the Voximplant Python SDK, you need the following:

  1. A developer account. If you don’t have one, sign up here.

  2. A private API key. There are 2 options to obtain it:

    1. Either generate it in the Voximplant Control panel

    2. Or 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).

  3. 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 VoximplantAPIConfig, VoximplantAPI

Next, specify the path to the JSON service account file either in the constructor or using the environment.

constructor:

config = VoximplantAPIConfig(
    credentials_file_path="/path/to/credentials.json",
)
api = VoximplantAPI(config=config)

env:

export VOXIMPLANT_CREDENTIALS=/path/to/credentials.json

Examples

Start a scenario

from voximplant.apiclient import VoximplantAPIConfig, VoximplantAPI, VoximplantException

if __name__ == "__main__":
    config = VoximplantAPIConfig(
        credentials_file_path="credentials.json",
    )
    api = VoximplantAPI(config=config)

    # Start a scenario of the user 1

    RULE_ID = 1
    SCRIPT_CUSTOM_DATA = "mystr"
    USER_ID = 1

    try:
        res = api.start_scenarios(RULE_ID, script_custom_data=SCRIPT_CUSTOM_DATA, user_id=USER_ID)
        print(res)
    except VoximplantException as e:
        print("Error: {}".format(e.message))

Send an SMS

from voximplant.apiclient import VoximplantAPIConfig, VoximplantAPI, VoximplantException

if __name__ == "__main__":
    config = VoximplantAPIConfig(
        credentials_file_path="credentials.json",
    )
    api = VoximplantAPI(config=config)

    # 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"

    try:
        res = api.send_sms_message(SOURCE, DESTINATION, SMS_BODY)
        print(res)
    except VoximplantException as e:
        print("Error: {}".format(e.message))

Get a call history item

from voximplant.apiclient import VoximplantAPIConfig, VoximplantAPI, VoximplantException
import pytz
import datetime

if __name__ == "__main__":
    config = VoximplantAPIConfig(
        credentials_file_path="credentials.json",
    )
    api = VoximplantAPI(config=config)

    # 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

    try:
        res = api.get_call_history(FROM_DATE, TO_DATE, count=COUNT)
        print(res)
    except VoximplantException as e:
        print("Error: {}".format(e.message))

Release files for voximplant-apiclient 2.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for voximplant-apiclient 2.10.0
File Size Uploaded
voximplant_apiclient-2.10.0.tar.gz 35.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for voximplant-apiclient 2.10.0
File Interpreter ABI Platform
voximplant_apiclient-2.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 69.9 kB

Release files / voximplant_apiclient-2.10.0.tar.gz

Download URL voximplant_apiclient-2.10.0.tar.gz
Size 35.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1b61ab6adbd22149fca9ba70bdf8fe236190ace9a0e9d7797733f5184f83d082
BLAKE2b-256 checksum
How to use checksums
b385f5827c1ed5c7327868aa142008a5584a945143a365ebc62b4bd9c3ccad14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Release files / voximplant_apiclient-2.10.0-py3-none-any.whl

Download URL voximplant_apiclient-2.10.0-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0bb7b8f769a1ec84414152b7bfff34b659fc978e2170c9eccf06fe4e8c289bf
BLAKE2b-256 checksum
How to use checksums
39c4a513389ff9b8cad2b4077135093c70357d55bc7d0afde0b0f7f512ddc35e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.4

Release history Release notifications | RSS feed

This release

2.10.0 This release

2 release files

2.9.0

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.15.0

2 release files

1.14.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.0.9

2 release files

1.0.7

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page