Python SDK for Bulletins
Project description
bulletins
Python SDK for the Bulletins API. Async client, SSE streaming, and a declarative bot framework.
Install
uv add bulletins-sdk
Quick start
Client
import asyncio
from bulletins import BulletinsClient
async def main():
# API key auth (bots, services)
client = BulletinsClient.from_api_key(
"bk_...",
base_url="https://bulletins.no",
party_id="...",
)
# Or login auth (scripts, testing)
client = await BulletinsClient.from_login(
"user@example.com", "password",
base_url="https://bulletins.no",
)
async with client:
threads = await client.list_threads()
for t in threads:
print(f"{t.name} ({t.status})")
await client.send_message(threads[0].id, "Hello from Python")
asyncio.run(main())
SSE streaming
async with client.stream_party() as stream:
async for event in stream:
print(f"[{event['type']}] {event.get('senderName')}: {event['content']}")
Bot
Declarative bot with auto-registration of custom event types:
import asyncio
from bulletins import Bot, EventTypeSpec
bot = Bot(
"Ping Bot",
event_types=[
EventTypeSpec("bot:pong", content_schema={"message": {"type": "string"}}),
],
)
@bot.on("message")
async def handle(event, client):
body = event.content.get("body", "")
if body.startswith("!ping"):
await client.send_message(event.thread_id, "pong")
asyncio.run(bot.start(
api_key="bk_...",
base_url="https://bulletins.no",
party_id="...",
integration_id="...",
))
Create the integration and API key in the Bulletins settings UI. The bot auto-registers its event types on startup.
API
BulletinsClient
| Method | Description |
|---|---|
list_threads() |
List threads for the active party |
get_thread(id) |
Thread detail with events and participants |
create_thread(name, to_party_id, body) |
Create a thread with initial message |
list_events(thread_id, before, limit) |
Paginated event history |
create_event(thread_id, type, content) |
Create any event type |
send_message(thread_id, body) |
Send a text message |
stream_party() |
SSE stream for all party events |
stream_thread(thread_id) |
SSE stream for a single thread |
list_integrations() |
List integrations |
get_integration_detail(id) |
Integration with all child resources |
create_event_type(integration_id, ...) |
Register a custom event type |
create_action(integration_id, ...) |
Create an action |
create_webhook(integration_id, ...) |
Create a webhook |
create_api_key(integration_id, ...) |
Create an API key |
get_agent_token(thread_id) |
LiveKit token for joining calls |
Bot
| Method | Description |
|---|---|
on(event_type) |
Decorator to register an event handler |
start(api_key, base_url, party_id, integration_id) |
Connect, register event types, dispatch loop |
stop() |
Stop the dispatch loop |
Requirements
Python 3.12+, httpx.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bulletins_sdk-0.1.0.tar.gz.
File metadata
- Download URL: bulletins_sdk-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aaf90fb532f857d6998f9fa622faad87cf93c9defd163c852a0e62fd7417994
|
|
| MD5 |
a7b5959318be38ccbedd9835c26da948
|
|
| BLAKE2b-256 |
e0174f18e6371e1eb5f0ded0b731926a74a242d5c44465fa05adee79c4773ca8
|
File details
Details for the file bulletins_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bulletins_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cd51e7faae152ef70ae3093c53ed92057a18c4c045204bd808a268a31eb542f
|
|
| MD5 |
22b6e63a181ed47af792f82ce778afe8
|
|
| BLAKE2b-256 |
9a12fbc0a50cb97800e614070a2e4732f65dbac89cf191213697d29e2d5131c5
|