Skip to content

snavid/BriqPythonSdk

Repository files navigation

Briq SDK

A Python SDK for interacting with the Briq messaging platform.

Installation

pip install BriqPythonSdk

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

About

A Python SDK for seamless integration with the Briq Bulk SMS platform, enabling developers to send and manage SMS messages effortlessly

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages