| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Minimal X Chat bot example with a login, unlock, and run flow. Everything the bot needs (tokens, keys, env) lives in this directory.
This example expects the XDK repos to be sibling directories (since chat-xdk is not released yet):
<parent>/ chat-xdk/ xchat-bot-python/
From the parent directory:
cd xchat-bot-python
cp env.template .envEdit .env with:
Install dependencies:
uv syncRun the login command and follow the prompt:
uv run xchat-bot-loginThis stores the OAuth2 token in state.json.
Fetch public keys, prompt for PIN, and store private keys locally:
uv run xchat-bot-unlockThis uses /2/users/:id/public_keys and stores:
All are saved in state.json.
Create a chat.received subscription for the authenticated user:
xurl -X POST --auth oauth2 "/2/activity/subscriptions" -d \
'{"event_type": "chat.received", "filter": {"user_id": "{id}"}, "tag": "bot received messages"}'Bare-bones echo bot:
uv run xchat-bot-runGrok-powered bot (requires Grok API token):
uv run xchat-bot-run-grokReaction-only bot (👀 read-receipt reaction):
uv run xchat-bot-run-reactThe xchat_bot_js/ directory contains a JavaScript equivalent using the WASM-based chat-xdk.
Install dependencies:
cd xchat_bot_js
npm installRun the bot:
npm run botThe JS bot uses the same XChatBot / XChatBotConfig interface from chat-xdk/bot. Configuration is provided inline via the XChatBotConfig constructor. See xchat_bot_js/decorator_example_bot.js for a full example.
Each bot connects to the Activity Stream using BEARER_TOKEN, decrypts incoming messages using private_keys, and replies using the OAuth2 user token.
| Back | FazBrowse Home | New Git URL |