Skip to main content

Python SDK for the Briq messaging API

Project description

Briq SDK

A Python SDK for interacting with the Briq messaging API.

Installation

pip install briq-sdk

Or install from source:

git clone https://github.com/snavid/briq-sdk.git
cd briq-sdk
pip install -e .

Usage

Authentication

from BriqPythonSdk import BriqClient

# Initialize the client
client = BriqClient(
    username="your_username",
    password="your_password"
)

Get Workspaces

Retrieve all workspaces accessible to the authenticated user:

workspaces = client.get_workspaces()
print(workspaces)

Send a Message

Send an instant message to one or more recipients:

response = client.send_message(
    workspace_id="your_workspace_id",
    recipients=["+255788344348"],
    content="Your message content here",
    sender_id="YourSenderId"
)
print(response)

Error Handling

The SDK provides specific exceptions for different types of errors:

from BriqPythonSdk import BriqAuthenticationError, BriqAPIError, BriqMessageError

try:
    response = client.send_message(...)
except BriqAuthenticationError as e:
    print(f"Authentication error: {e}")
except BriqMessageError as e:
    print(f"Message sending error: {e}")
except BriqAPIError as e:
    print(f"API error: {e}")

API Reference

BriqClient

BriqClient(username: str, password: str)

Parameters:

  • username: The username for authentication
  • password: The password for authentication

Methods

get_workspaces()
get_workspaces() -> List[Dict[str, str]]

Returns:

  • List of workspace objects containing details like workspace_id and available sender IDs

Raises:

  • BriqAPIError: If retrieving workspaces fails
send_message()
send_message(
    workspace_id: str,
    recipients: List[str],
    content: str,
    sender_id: str
) -> Dict[str, Any]

Parameters:

  • workspace_id: The ID of the workspace
  • recipients: List of recipient phone numbers (with country code)
  • content: The message content
  • sender_id: The sender ID to display

Returns:

  • The API response as a dictionary

Raises:

  • BriqMessageError: If sending the message fails

License

MIT

Project details


Download files

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

Source Distribution

briqpythonsdk-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

BriqPythonSdk-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file briqpythonsdk-0.1.0.tar.gz.

File metadata

  • Download URL: briqpythonsdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for briqpythonsdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e360880959c4ec9087a51a8f681458809b0d0c8ea1180b04475b36424d7fc705
MD5 9cb5af2561a01c591795d090c361e0e4
BLAKE2b-256 923fbc2e87a1e5883bbbedd51a8f320a9ad5aab380eed022a51b9ecefd1d44f6

See more details on using hashes here.

File details

Details for the file BriqPythonSdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: BriqPythonSdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for BriqPythonSdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fdf32309ae3233880bf5430068a8780c4bab2316e465e0f1e936664e60b9f9d
MD5 d82c6583f34ed7cfdd2a4fb919d3ccc5
BLAKE2b-256 35a7cc862609c0df7434a2241d75da7bd4f17e017e864cecaf444258040baab7

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