Skip to main content

Official Python SDK and CLI for interfacing with the Jaxl API. Manage calls, messages, IVRs, devices, teams, payments, campaigns, streaming transcriptions and AI Agents. Built on OpenAPI, it offers both generated API clients and Pythonic wrappers for ease of use.

Project description

Jaxl CLI & Jaxl Python API Client

Use Jaxl from Python code or directly via the jaxl command-line tool.

  1. Install
  2. JAXL CLI
  3. Jaxl Python SDK
  4. JAXL HTTP Webhook Protocol
  5. SDK Documentation
  6. Status

Install

pip install -U jaxl-python

JAXL CLI

jaxl -h
usage: jaxl [-h] {accounts,apps,calls,campaigns,devices,ivrs,kycs,members,messages,notifications,payments,phones,teams} ...

Jaxl CLI

positional arguments:
  {accounts,apps,calls,campaigns,devices,ivrs,kycs,members,messages,notifications,payments,phones,teams}
    accounts            Manage Accounts
    apps                Manage Apps for Webhooks and Streaming audio/speech/transcriptions.
    calls               Manage Calls (Domestic & International Cellular, App-to-App)
    campaigns           Manage Campaigns
    devices             Manage Devices
    ivrs                Manage IVRs (Interactive Voice Response)
    kycs                Manage KYCs
    members             Manage Members
    messages            Manage Messages (SMS, WA, RCS, Email, App-to-App)
    notifications       Manage Notifications (Android, iOS, Web)
    payments            Manage Payments
    phones              Manage Phones (Landline, Mobile, TollFree)
    teams               Manage Teams (Managers, Phones)

options:
  -h, --help            show this help message and exit

Setup

You will require the following to successfully run jaxl command line tool:

  • JAXL_API_CREDENTIALS: Required to connect with Jaxl API Infrastructure
  • JAXL_API_AUTH_TOKEN: Ensure necessary permissions are added to generated auth token.

Please visit Jaxl Business Website or download the Jaxl Business Android or Jaxl Business iOS mobile application to access your credentials and auth tokens.

Finally, setup following environment variables when trying jaxl command line.

export JAXL_API_CREDENTIALS=/path/to/jaxl-api-credentials.json
export JAXL_API_AUTH_TOKEN="....authentication token...."

Verify API Credentials & Auth Token

jaxl accounts me

Check Account Balance

jaxl accounts balance

Create an IVR

jaxl ivrs create \
  --message "Hello, we are calling via Jaxl IVR demo created from CLI"

Create a hangup IVR

This IVR will speak the message and then hangup the call.

jaxl ivrs create \
  --message "Hello, we are calling via Jaxl IVR demo created from CLI" \
  --hangup

Configure IVR Options

This IVR option uses --next to send user to another IVR.

jaxl ivrs options configure \
  --ivr <IVR ID TO CONFIGURE> \
  --input 0 \
  --message "Press 0 to repeat this menu" \
  --next <NEXT IVR ID>

Use <IVR ID TO CONFIGURE> as the <NEXT IVR ID> to complete the "repeat this menu" experience.

One of the CTA key flag must be provided. Allowed CTA keys are:

  • --next: Send to another IVR
  • --phone: Send to an external phone number
  • --devices: Send to devices by ID
  • --appusers: Send to app users (org employees) by ID
  • --teams: Send to teams by ID

List IVRs

jaxl ivrs list

List Purchased Jaxl Numbers

jaxl phones list

You can also search for a specific purchased number:

jaxl phones list --e164 "+91<Purchased Jaxl Number>"

Assign a Phone Number to IVR by ID

All incoming calls to this number will send user to the assigned IVR.

jaxl phones ivrs \
  --e164 "+91<Purchased Jaxl Number>" \
  --ivr <IVR ID>

Place Outgoing Cellular Call with Existing IVR

Below command will execute the following flow:

  • Places a call to <Callee Number>
  • When answered sends them to an existing IVR ID
  • Once IVR finishes, call continues to CTA returned by IVR
jaxl calls create \
  --to "+91<Callee Number>" \
  --from "+91<Purchased Jaxl Number>" \
  --ivr <IVR ID>

Place Outgoing Cellular Call with Ad-hoc IVR

Below command will execute the following flow:

  • Creates an Ad-hoc IVR using --message and --option flags
  • Places a call to
  • When answered sends callee to the ad-hoc IVR
  • Once IVR finishes, call continues to CTA returned by IVR
jaxl calls create \
  --to "+91<Callee Number>" \
  --from "+91<Purchased Jaxl Number>" \
  --message "Hello, we are calling you from MyCompany" \
  --option "1=Press 1 for sales:team=<Sales Team ID>" \
  --option "2=Press 2 for HR department:team=<HR Team ID>

Dial-out Multi-Party Conference between Cellular Numbers

Below command will execute the following flow:

  • Dials out all --to participants in parallel
  • Connects them together as they answer the call
  • Ends the call when one but all others have hanged up the call
jaxl calls create \
  --to "+91<Doctors Number>" \
  --to "+91<Patient Number>" \
  --to "+91<Supervisor Number>" \
  --from "+91<Purchased Jaxl Number>"

Dial-out Agent Team and Cellular Numbers

Below command will execute the following flow:

  • Dials out multiple teams of doctors & patient in parallel
  • Connects the patient with first doctor to pick the call from the teams
  • Doctors are called on their cellular number first (if added on Jaxl app), followed by an attempt to call on Jaxl app directly (VoIP).
  • Calling preference can be controlled per agent (doctor) or team to dictate whether to use cellular or voip first to connect with a doctor.
jaxl calls create \
  --to "teams=<Doctors Team ID1>,<Doctors Team ID2>" \
  --to "+91<Patient Number>"

Dial-out 2-Party Conference with Ad-hoc IVR

Below command will execute the following flow:

  • Dials out to Doctor first
  • When doctor answers the call, they are asked to press 1 when ready
  • If doctor presses 1, a second call is placed to the patient
  • Ends the call when one but all others have hanged up the call
jaxl calls create \
  --to "+91<Doctors Number>" \
  --from "+91<Purchased Jaxl Number>" \
  --message "Hello Doctor, this is a call from MyCompany regarding your appointment with Mr. Patient Name. When ready please, " \
  --option "1=Press 1 to connect with the patient:phone=+91<Patient Number>"

Add External Phone Number to an Active Call

jaxl calls add --call-id 1234 --phone +91<Mobile Number>

Add Agent to an Active Call

jaxl calls add --call-id 1234 --agent <someone@mycompany.com>

Remove External Phone Number from an Active Call

jaxl calls remove --call-id 1234 --phone +91<Mobile Number>

Remove Agent from an Active Call

jaxl calls remove --call-id 1234 --agent <someone@mycompany.com>

Send Text Prompts (TTS) in an Active Call

jaxl calls speak --call-id 1234 \
  --prompt "Hello, this text was injected in the middle of an active call" \
  --prompt "Yes its possible to pass in multiple prompt flags" \
  --prompt "Use shorter prompt phrases to keep TTS latency low" \
  --prompt "Avoid using excessively large sentences"

Play Audio File in an Active Call

jaxl calls play --call-id 1234 --audio /path/to/a/file/on/local/disk/or/public/url

NOTE: Audio file must be in SLIN16 format i.e. 8KHz Mono 16-bit.

Mute a Participant in an Active Call

Mute a specific cellular user in a call.

jaxl calls mute --call-id 1234 --phone +91<Mobile Number>

Mute an agent (Jaxl App User) in a call.

jaxl calls mute --call-id 1235 --agent <someone@mycompany.com>

Unmute a Participant in an Active Call

Unmute a specific cellular user in a call.

jaxl calls unmute --call-id 1234 --phone +91<Mobile Number>

Unmute a specific agent (Jaxl App User) in a call.

jaxl calls unmute --call-id 1235 --agent <someone@mycompany.com>

Hold a Participant in an Active Call

Put a cellular user on-hold in a call

jaxl calls hold --call-id 1234 --phone +91<Mobile Number>

Put an agent on-hold in a call

jaxl calls hold --call-id 1235 --agent <someone@mycompany.com>

Unhold a Participant in an Active Call

Unhold a cellular user in a call

jaxl calls unhold --call-id 1234 --phone +91<Mobile Number>

Unhold an agent in a call

jaxl calls unhold --call-id 1235 --agent <someone@mycompany.com>

Receive Call Events via Webhook IVRs

Webhook IVRs can be used to programatically control the lifecycle of incoming and outgoing calls. Jaxl will invoke configured webhook URL for subscribed call events. Handle the webhook request and use Jaxl SDK to continue and customise the call flows.

To create a webhook IVR, use a https:// URL as --message flag e.g.

jaxl ivrs create --message "https://example.com/jaxl-webhook-ivr"

Next, assign a number to webhook IVR as shown previously under Assign a Phone Number to IVR by ID. Now, all incoming calls on the number will start with webhook before proceeding further.

To control flow of outgoing calls, use webhook IVR ID when placing an outbound call. See Place Outgoing Cellular Call with Existing IVR

See examples directory for working webhook examples.

Realtime Streaming Audio

Refer to examples directory for working streaming audio examples.

Realtime Streaming Speech Segments

Refer to examples directory for working streaming speech segments examples.

Realtime Streaming Transcriptions per Speech Segment

Refer to examples directory for working streaming transcription per speech segment examples.

AI Agent: Realtime Transcriptions STT ➡️ LLM/MCP ➡️ TTS

Refer to examples directory for working AI Agent examples.

List Subscriptions Payments

jaxl payments subscriptions list

List Consumable Payments

jaxl payments consumables total

Jaxl Python SDK

  • Jaxl APIs is built upon OpenAPI specification
  • jaxl-python contains following Python modules:
    • jaxl.api.client: Generated OpenAPI SDK
    • jaxl.api.resources: Wrapper methods written to support jaxl CLI
    • jaxl_api_client: Helper function to retrieve an instance of JaxlApiClient

SDK Example Usage:

from jaxl.api import JaxlApiModule, jaxl_api_client
from jaxl.api.client.api.v1 import v1_calls_list

os.environ.setdefault("JAXL_API_CREDENTIALS", "/path/to/jaxl-api-credentials.json")

os.environ.setdefault("JAXL_API_AUTH_TOKEN", "....authentication token...")

response = v1_calls_list.sync_detailed(
    client=jaxl_api_client(JaxlApiModule.CALL),
    currency=2, # 1=USD, 2=INR
)

SDK Documentation

# Clone this repository
git clone git@github.com:jaxl-innovations-private-limited/jaxl-python.git

# Enter cloned repo directory
cd jaxl-python

# Create virtual environment
python3 -m venv .venv

# Activate virtual environment
source .venv/bin/activate

# Install
pip install -e ".[dev]"

# Generate documentation
./docs.sh

# View documentation in browser
open docs/jaxl/index.html

Status

Python 3.x

Checked with mypy

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jaxl_python-0.0.11.tar.gz (104.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaxl_python-0.0.11-py3-none-any.whl (212.5 kB view details)

Uploaded Python 3

File details

Details for the file jaxl_python-0.0.11.tar.gz.

File metadata

  • Download URL: jaxl_python-0.0.11.tar.gz
  • Upload date:
  • Size: 104.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for jaxl_python-0.0.11.tar.gz
Algorithm Hash digest
SHA256 45d2383ec702f63a7b6cea1e5743dc3fa25e3b5accfc3bcb9c7a7977f97db0af
MD5 add8c97a386741fc11e292b02a80266d
BLAKE2b-256 3302d312c2cc0e6271bba4b6222d283d818f9a3ea496aad69c7ef151128a51b1

See more details on using hashes here.

File details

Details for the file jaxl_python-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: jaxl_python-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 212.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for jaxl_python-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8528a9ea08b0734f4077384baa32dd15f8322c90a117e897f4cae2b386ba349c
MD5 73396a4273fe6867652e1cc112b4d83b
BLAKE2b-256 2c4518e705b362360960fce66f5c3b8c8a4769ff62c1310ab32ea89e1451df85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page