Python SDK for Bitrix24 bots via VibeCode API — async framework like aiogram
Project description
vibecode-b24-bot
Python SDK for Bitrix24 bots via VibeCode API.
Async bot framework like aiogram, but for Bitrix24. Plus CRM/tasks/entities client.
Install
pip install vibecode-b24-bot
Quick start — Bot
import os
from vibecode import Bot, bb
bot = Bot(
api_key=os.environ["VIBE_API_KEY"],
bot_code="my_bot",
bot_name="My Bot",
)
@bot.on_message
async def handle(msg):
await msg.typing("thinking")
await msg.answer(f"You said: {bb.bold(msg.text)}")
@bot.on_command("help")
async def help_cmd(msg, cmd):
await msg.answer("I'm a bot!")
bot.run()
Quick start — CRM / Entities
import asyncio, os
from vibecode import VibeCode
async def main():
async with VibeCode(api_key=os.environ["VIBE_API_KEY"]) as client:
deals = await client.list_entity("deals", limit=10)
for d in deals:
print(d["TITLE"], d["OPPORTUNITY"])
asyncio.run(main())
Features
- Bot framework with decorators (
@bot.on_message,@bot.on_command) - Async polling with auto offset tracking, deduplication, exponential backoff
- 35 entities — deals, contacts, tasks, users, calendar, disk, etc.
- Batch API — 50 calls in 1 request
- BB-code formatting —
bb.bold(),bb.italic(),bb.code(),bb.link() - Typing indicators — 11 statuses (thinking, searching, generating...)
- Chat management — create chats, manage users, slash-commands
- File upload/download
- Zero config — just API key and
bot.run()
Bot types
Bot(api_key=key, bot_type="bot") # Standard — responds to @mention and DMs
Bot(api_key=key, bot_type="personal") # AI assistant — sees ALL messages
Bot(api_key=key, bot_type="supervisor") # Observer — monitoring, analytics
Formatting (BB-codes)
Bitrix24 chat uses BB-codes, not Markdown:
from vibecode import bb
bb.bold("important") # [b]important[/b]
bb.italic("note") # [i]note[/i]
bb.code("x = 1") # [code]x = 1[/code]
bb.link("https://...", "Go") # [url=https://...]Go[/url]
bb.strike("old") # [s]old[/s]
bb.quote("cited text") # [quote]cited text[/quote]
bb.list(["a", "b", "c"]) # [list][*]a[*]b[*]c[/list]
bb.mention(user_id=42) # [user=42][/user]
Message object
@bot.on_message
async def handle(msg):
msg.text # message text
msg.dialog_id # chat/dialog ID
msg.from_user # User object (id, name, email)
msg.message_id # message ID
msg.chat # Chat object (id, name, type)
await msg.answer("reply") # send reply
await msg.typing("thinking") # show typing
await msg.react("like") # add reaction
Low-level client
async with VibeCode(api_key=key) as client:
# Entity CRUD
await client.list_entity("deals", limit=50)
await client.get_entity("deals", 123)
await client.create_entity("deals", title="New", amount=50000)
await client.update_entity("deals", 123, stageId="WON")
await client.delete_entity("deals", 123)
await client.search_entity("deals", filter={"stageId": "NEW"})
# Batch
await client.batch([
{"method": "crm.status.list"},
{"method": "crm.deal.fields"},
])
# Direct method call
await client.call("app.info")
# Portal info
await client.me()
Examples
See examples/ directory:
echo_bot.py— simple echo botai_assistant.py— LLM-powered chat bot (any OpenAI-compatible API)crm_dashboard.py— fetch CRM deals
License
MIT
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
vibecode_b24_bot-0.1.0.tar.gz
(11.6 kB
view details)
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 vibecode_b24_bot-0.1.0.tar.gz.
File metadata
- Download URL: vibecode_b24_bot-0.1.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ec7f8c5273ddf6ec350175491f3eaf17bd86abc8bc33d62d513a001cb072314
|
|
| MD5 |
beb66597eb2240fcb0f6c07265bcad38
|
|
| BLAKE2b-256 |
ab1906048bd4ace137c7c6caa123829612a0011ad0194dc325e24061c14a39d2
|
File details
Details for the file vibecode_b24_bot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vibecode_b24_bot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13bf57ffae3df8f504c4cda1b6986b78c4503ffa31f7af26ed7161958a133668
|
|
| MD5 |
3aee24e4fde7f0bb00795ae9798843cf
|
|
| BLAKE2b-256 |
a31cb6c2efa8012c7c09333d0ddb691027bdb80aa517364a114ed81e814fe594
|