Skip to Content
Setup

Grok Bot

Grok Bot is xAI’s desktop agent app. A routine is a saved task. This connection uses a webhook, a web address that SwB calls to start the routine.

Before you start

Install Grok Bot on a supported computer. Sign in with a plan that includes Grok Bot.

Set up a public HTTPS address and owner sign-in for SwB. Enable the grok-routine block. Choose a SwB project. With OAuth, you approve access in your browser.

Copy the setup prompt

Read the setup guide at https://swb.one/docs/setup/grok-bot.

Help me connect Grok Bot to SwB. SwB uses a webhook to start a Grok Bot routine. A webhook is a request to a URL when an event occurs.

Check your tools first. If the SwB tools are missing, ask me to open the Grok Bot desktop app. Use `Connect apps > Add a custom connector > Remote HTTPS`. Ask me to enter my public SwB MCP address, such as `https://swb.example.com/mcp`. If Grok Bot opens SwB sign-in, ask me to approve access. If sign-in fails, use another SwB client with owner access to register the routine. If Grok Bot supports bearer keys, set up its key with https://swb.one/prompts/mcp-client.md.

Call `connect(what="grok-bot")` from a client with owner access. Do each step marked "you" yourself. Give me each step marked "person" one at a time with the exact click path and links. Wait for me to say done after each step. Call `connect` again with the same choices to check progress.

If `connect` asks for a routine, ask Grok Bot to create one with a custom webhook trigger. Use the routine prompt that `connect` returns. Register a routine that uses a webhook key with `connect(what="grok-bot", choose={"name":"<routine>","project":"<project>","auth":"key"})`. For a signed trigger, use `auth="signature"`.

Ask me to open the routine's webhook settings. Ask me to enter the POST URL and the key or signing secret through their SwB claim links. Keep the values out of this chat, the routine prompt and tool arguments. Pass `header` only if the trigger uses a custom header.

Run the `send` call that `connect` returns. Call `connect` again to check that Grok accepted the webhook. Use `wait` or `inbox` to collect the reply. Show me the reply if it arrives.

For a message sent to the routine, use the saved routine prompt. Answer with `reply` on the conversation from the webhook payload. Use `wait` or `inbox` to read other messages in this chat.

Set up memory sync. Call `memory_summary` to load shared memory. Look at what you already remember about me in your own memory. Choose the facts that every agent should know. Leave out passwords, keys and sensitive personal details. Send the facts in one `memory_sync` call with `source="grok-memory"`. Give each fact a stable `source_key`. Show me what you sent. After that, call `memory_sync` in the same turn each time you save a new memory. See https://swb.one/docs/memory.

Paste the prompt into your Bot chat after you add SwB.

Connect Grok Bot

Make a Bot

Use the Bot from onboarding, or select New Bot with + in the sidebar. Enter a name. Select Create.

Open Connect apps

In the sidebar, open Connect apps. Select Add a custom connector.

Enter the address

Enter SwB in Name. Select Remote HTTPS under Type. Enter https://swb.example.com/mcp in Server URL. Select Add plugin.

Sign in

Leave the optional OAuth client fields empty. If Grok Bot opens SwB sign-in, sign in as the owner. Approve access.

Open the routine

Open the routine under Details in your Bot chat. Check the Webhook trigger.

Save the webhook URL

Open the claim link for the webhook address. Copy POST to from the routine. Paste it into Webhook URL. Select Save webhook url.

Save the key

Open the claim link for the webhook key. Copy key from the routine. Paste it into Token. Select Save token.

Tell Grok Bot

Say done in the Bot chat. Grok Bot then tests the routine.

What the agent does

Use an agent with owner access to call connect(what="grok-bot"). SwB returns the MCP address, the OAuth state and a routine prompt. The prompt uses the webhook trust field to tell the routine which requests it can act on. The routine answers with reply.

Ask Grok Bot to create the routine with the prompt. In your owner client, register it with connect(what="grok-bot", choose={"name":"<routine>","project":"<project>","auth":"key"}). SwB makes separate claim links for the address and key. After you save both, run the send call that connect returns.

When you send to the routine, SwB calls its webhook to start it.

Credentials

TokenWhere it is shownFormatWhere it goes
Webhook URLPOST to under Webhook in the routine DetailsHTTPS addressWebhook URL on its SwB claim link
Webhook keykey under Webhook in the routine DetailsRandom textToken on its SwB claim link
SwB sign-in tokenGrok Bot gets it when you sign inRandom textGrok Bot keeps it for you

A claim link is a private one-time SwB page for one token. Paste each value there only.

Check the connection

Open the routine Details. Check the Webhook trigger. Call connect(what="grok-bot") again from your owner client. The status line names the routine. Check inbox on the sending client for the test reply.

Fix problems

If OAuth sign-in fails, use another SwB owner client to register the routine. If the connector accepts a bearer key, use a paired key.

Copy the key value. With the default header, SwB adds Authorization: Bearer.

Use grok-routine:routine:<routine> to start the routine. Use agent:grok to send to the Grok mailbox.

Claim links work one time and expire after 30 minutes. For a new link, call connect again. To change a saved value, call connect with choose.replace set to url or secret.

On this page