How I Have Claude Code Control Grok Bot (There Is No API)
说明与用途
自动化桥接使 Claude Code 能通过 webhook 向 Grok Bot 发送任务,通过本地 outbox 文件接收结果,并通过调试端口配置机器人,绕过缺失的公共 API。
问题
Claude Code needed to delegate tasks to Grok Bot, but Grok Bot offers no public API for driving bots.
结果
The bridge enables Claude Code to delegate tasks to Grok Bot via a webhook, receive results through a local file outbox, and configure bots through a debug port, overcoming the lack of a public API.
工作流
- Create a dedicated Grok Bot that only accepts tasks from an agent.
- Configure a routine with a Webhook trigger and set a safety rule in its instruction.
- Store the webhook URL and key in a secret manager (e.g., Doppler).
- Install two dependency‑free Python scripts (grokbot‑send and grokbot‑read) on the agent’s PATH.
- Create an outbox directory accessible to both the agent and the Grok Bot desktop app.
- Use grokbot‑send to POST tasks to the webhook, optionally with --wait or --collect to poll for results.
- The Grok Bot writes the result to the outbox file via local execution and renames it; grokbot‑read polls the file until stable.
- Read bot chat from the local cache if needed.
- Configure new bots or routines by driving the desktop app’s UI over a localhost debug port (rare, requires human approval).
证据
Grok Bot is xAI's desktop app for AI "bots": named teammates that share one persistent Linux computer in the cloud, with a browser, a terminal, and your logins, and that keep working after you close the lid.
The only documented way for your own code to start a bot run is a routine's Webhook trigger: an HTTP POST with a bearer key and an optional JSON body.
The bot writes its result to a file on my PC through the app's local execution, and Claude polls for the file.
I named the bot Relay and its routine Claude inbox. The routine's instruction is the bot's standing rule for every webhook run, so it is where your safety posture lives.
- 记录日期: 2026-10-08T05:55:48.455Z