Skip to main content

Python SDK for interacting with the CxEngage API

Project description

CxAdmin

CxAdmin is a Python API client for the CxEngage API. It is a work in progress and is not yet complete.

All objects are designed to mirror their CxEngage counterparts. For example, a CxList object has the exact same properties as a list on the CxEngage platform. Together with the way this program is designed, this means you can fetch items from CxEngage, manipulate them locally, and then upload them back to CxEngage, without having to worry about the API.

This API is designed to be easily expandable. If you would like to add functionality, please feel free to submit a pull request.

To Do

  • [] Any object to CSV
  • Any object to JSON

Usage – Contents

Set up API client

import CxAdmin

cx = CxAdmin.Cx(
    baseURL="your_base_url", # https://eu-west-1-prod-api.cxengage.net for EU, https://api.cxengage.net for US
    apiKey="your_api_key",
    apiSecret="your_api_secret",
    tenantID="your_tenant_id",
)

or

import CxAdmin

cx = CxAdmin.Cx.fromConfigFile("config.json")

 Example config.json

{
    "baseURL": "https://eu-west-1-prod-api.cxengage.net",
    "apiKey": "73668f12-4da1-9991-p182-83ufb38193pa",
    "apiSecret": "biglongjumblystringoflettersandnumbershere",
    "tenantID": "893jwa23-85k2-895k-1562-93pot7367185"
}

Get Everything

Get everything

from CxAdmin import Cx
import json

cx: Cx
dev = True
if dev:
    cx = Cx.fromConfigFile("config.dev.json")
else:
    cx = Cx.fromConfigFile("config.prod.json")

for item in cx.items:
    print(item)
    out = item.get()
    name = str(item)[13:]
    name = name[: name.index(".")]
    file = open(f"output/{name}.json", "w")
    output = json.dumps(out)
    file.write(output)

This will fetch all items from CxEngage and save them to output/ as JSON files.

Queues

Get list of queues

cx.queues.getQueues()

or

cx.queues.get() # same as getQueues()

Get active queues

cx.queues.getActiveQueues()

Lists

Get all lists

cx.lists.get()

Get list by ID

cx.lists.getList(listId)

Get list as CSV

cx.lists.getListCSV(listId)

Convert list object to CSV

myList = cx.lists.getList(listId) # get a list
csv: list[str] = myList.toCSV() # convert to CSV, returns a list of strings

Users

Get all users

cx.users.getAllUsers()

or

cx.users.get() # same as getAllUsers()

Groups

Get all groups

cx.groups.getGroups()

or

cx.groups.get() # same as getGroups()

Hours

Get list of business hours

hours = cx.hours.get()

Get info for a specific business hours object (example)

for hour in hours:
    print(f"{hour.name} - {hour.getBusinessHours()})

Environment

Get tenant

cx.environment.getTenant()

or

cx.environment.get() # same as getTenant()

Get regions

cx.environment.getRegions()

Flows

Get all flows

cx.flows.getFlows()

or

cx.flows.get() # same as getFlows()

Statistics

cx.statistics.getInteractions(between: (datetime, datetime))

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

CxAdmin-1.0.61a2.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

CxAdmin-1.0.61a2-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file CxAdmin-1.0.61a2.tar.gz.

File metadata

  • Download URL: CxAdmin-1.0.61a2.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for CxAdmin-1.0.61a2.tar.gz
Algorithm Hash digest
SHA256 65d99377dd4a7a3e0135615d48b93616636e9020fcbf726293b3c2238690b166
MD5 c06ab3c610033e4670cdf535cc4d3958
BLAKE2b-256 42df787ead4e0d27272019ba74aee13cf6d53dc08c870e5e05eb8a730b3953f2

See more details on using hashes here.

File details

Details for the file CxAdmin-1.0.61a2-py3-none-any.whl.

File metadata

  • Download URL: CxAdmin-1.0.61a2-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for CxAdmin-1.0.61a2-py3-none-any.whl
Algorithm Hash digest
SHA256 39d6ca04eff30ada72348b5fbf6b69ceb00ffe9888397f26b54c980caadf6c4c
MD5 4d7d06b7922799a605ebaa98b8450d61
BLAKE2b-256 3894776701b666c2c7ad98dd98d8b337286a2bb540027ba41269a2fbc514648a

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