A Python SDK for interacting with the Briq messaging platform.
pip install BriqPythonSdkOr install from source:
git clone https://github.com/snavid/briq-sdk.git
cd briq-sdk
pip install -e .from BriqPythonSdk import BriqClient
# Initialize the client
client = BriqClient(
username="your_username",
password="your_password"
)Retrieve all workspaces accessible to the authenticated user:
workspaces = client.get_workspaces()
print(workspaces)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)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}")BriqClient(username: str, password: str)Parameters:
username: The username for authenticationpassword: The password for authentication
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(
workspace_id: str,
recipients: List[str],
content: str,
sender_id: str
) -> Dict[str, Any]Parameters:
workspace_id: The ID of the workspacerecipients: List of recipient phone numbers (with country code)content: The message contentsender_id: The sender ID to display
Returns:
- The API response as a dictionary
Raises:
BriqMessageError: If sending the message fails
MIT