debox-chat-python-sdk is the official Python SDK for DeBox Chat Service.
- Python >= 3.9
- SDK package:
boxbotapi/ - Runnable demo entry:
main.py
pip install -e .export DEBOX_BOT_API_KEY="YOUR_BOT_API_KEY"
export DEBOX_BOT_API_SECRET="YOUR_BOT_API_SECRET"import boxbotapi
bot = boxbotapi.NewBotAPI(
"YOUR_BOT_API_KEY",
"YOUR_BOT_API_SECRET",
)
msg = boxbotapi.NewMessage("DEBOX_USER_ID", "private", "Hello, DeBox!")
bot.Send(msg)python3 main.pyDemo behavior:
- Calls
bot/getMeduring startup - Long-polls
bot/getUpdates - Handles text messages and callback buttons
- Edits message content with inline keyboard (
bot/editMessageText)
import boxbotapi
from boxbotapi import configs as cfg
cfg.Debug = False
cfg.MessageListener = True
bot = boxbotapi.NewBotAPI(
"YOUR_BOT_API_KEY",
"YOUR_BOT_API_SECRET",
)
u = boxbotapi.NewUpdate(0)
u.Timeout = 60
for update in bot.GetUpdatesChan(u):
if update.Message is not None:
msg = boxbotapi.NewMessage(update.Message.Chat.ID, update.Message.Chat.Type, "Received")
bot.Send(msg)- Auth headers include
X-API-KEY,nonce,timestamp,signature,X-Request-Id signature = sha1(apiSecret + nonce + timestamp)