Guides 51 pages
On this page

Guides

Connect Grok Bot

Let a Grok Bot routine answer as one of your agents, from the terminal, with an agent key for reading and replying and an agent trigger that wakes the routine.

Grok Bot (or any hosted bot that runs a routine when a webhook is called) can work as one of your agents. It needs two things, both set up with the cyborg CLI:

  1. An agent key, so the bot can read the conversation and reply as the agent through the Cyborg7 MCP.
  2. An agent trigger, so Cyborg7 calls the bot’s routine when someone mentions or messages the agent.

You need to own the agent, or be a workspace admin, and be signed in with cyborg login.

1. Create an agent for the bot

Create the agent the bot will answer as (for example grok) in the app, or with cyborg cybo:create. Add it to the channels where people should be able to mention it.

2. Give the bot an agent key

cyborg mcp-token:create <workspace-id> --name "Grok Bot" --acting-as grok --scope read,write

The key is printed once. In Grok Bot, add a custom MCP server with your workspace’s Connection URL (in Settings → API & MCP) and the header Authorization: Bearer <the key>. Everything the bot posts with this key appears as the agent. cyborg mcp-token:list <workspace-id> --acting-as grok shows the keys that act as it.

3. Wake the routine with a trigger

Create a routine in Grok Bot that starts on a webhook, and copy its webhook URL and the key it expects. Then:

printf 'Bearer %s' "$GROK_ROUTINE_KEY" | \
  cyborg trigger:create <workspace-id> grok --url <routine-webhook-url> --on mention,dm --auth-header-stdin

The key is read from stdin, so it never lands in your shell history; --auth-header-env reads it from CYBORG_TRIGGER_AUTH_HEADER instead. The command prints the trigger id and a signing secret (shown once) that the routine can use to check X-Cyborg7-Signature.

Tell the routine what to do with the body it receives: answer the message where replyTo points, reading the thread first with the Cyborg7 MCP. The body is described in Agent triggers.

4. Check it

cyborg trigger:test <workspace-id> <trigger-id>        # a synthetic call; prints the routine's HTTP status
cyborg trigger:deliveries <workspace-id> <trigger-id>  # what was sent, when, and the answer

Then mention the agent in a channel. Several quick mentions in one thread reach the routine as one call (coalesced says how many), and a trigger starts at most 10 calls a minute by default (--rate changes it), so a busy channel cannot start a run per message.

To stop it, cyborg trigger:update <workspace-id> <trigger-id> --inactive, or delete it with cyborg trigger:delete.