Skip to main content

Commsuite Bot API

Bots are real Commsuite accounts (role = 'bot'). They appear in People, can be added to groups, and cannot sign in with a password. Each bot has an API token that lets your own program act as that account.

Create a bot in Settings → Developer tools, then open API on the bot card to copy its token. The same dialog contains a ready-to-run Python example.

Endpoints

All requests use Authorization: Bearer cmsb_….

Method Path Purpose
GET /api/bot/me Bot identity
GET /api/bot/updates?offset=0&timeout=30&limit=100 Long-poll incoming messages
POST /api/bot/sendMessage Send a message

sendMessage body:

{ "conversationId": "…", "text": "hello", "replyTo": "optional-message-id" }

updates response:

{
  "updates": [
    {
      "updateId": 42,
      "conversationId": "…",
      "message": { "id": "…", "senderId": "…", "body": "hi", "…": "…" }
    }
  ]
}

Pass the last updateId as offset on the next request; acknowledged updates are deleted. timeout keeps the request open while the bot is idle (maximum 50 seconds). A paused bot rejects its token with 401.

A bot can also call the regular user API (/api/conversations, /api/conversations/:id/messages, …) with the same token.

Python

pip install commsuite-bot
from commsuite_bot import CommsuiteBot

bot = CommsuiteBot("http://localhost:3000", "cmsb_…")

def handle(update):
    message = update["message"]
    bot.send_message(update["conversationId"], "echo: " + message["body"])

bot.run(handle)

The package is a single standard-library module, so it also works by copying commsuite_bot.py next to your script. See example_echo_bot.py for a complete echo bot. Only Python 3.8+ is required; there are no external dependencies.

Publishing a new version (maintainers): python -m build then twine upload dist/* from this folder, with TWINE_USERNAME=__token__ and TWINE_PASSWORD set to a PyPI API token.

Built-in replies and mini-apps

Bots without an external program can still use keyword replies and one mini-app (JSON formatter, Base64, or UUID generator). Both are managed from the bot card in Developer tools. send /help to a bot to discover its commands.

External programs receive updates for every message sent to the bot by a human account. Messages sent by other bots are not queued, which prevents runaway loops between automated accounts.

Metadata

Release files for commsuite-bot 1.0.41

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for commsuite-bot 1.0.41
File Size Uploaded Provenance Actions
commsuite_bot-1.0.41.tar.gz 3.8 kB Without provenance Details for commsuite_bot-1.0.41.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for commsuite-bot 1.0.41
File Interpreter ABI Platform Actions
commsuite_bot-1.0.41-py3-none-any.whl Python 3 none any Details for commsuite_bot-1.0.41-py3-none-any.whl

Total release size: 7.7 kB

Release files / commsuite_bot-1.0.41.tar.gz

Download URL commsuite_bot-1.0.41.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3622482701183a996c5a67ccae7231bbda5eaf5b6472d813a5e5e39f28d830da
BLAKE2b-256 checksum
How to use checksums
08b1095710f525b0d1d733a4a5008e409942b7d051e04535ec7757809e07caab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / commsuite_bot-1.0.41-py3-none-any.whl

Download URL commsuite_bot-1.0.41-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8255a64bbc7666d69d1167e82712b373ab556b46e2db95869d2d6b955dcc011
BLAKE2b-256 checksum
How to use checksums
a29dd0267f077fe28aebf217aadd4bef984d52472a4cd3738a430b5ee3f4fdb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for commsuite-bot 1.0.41

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.41 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page