Grok Bot
このページは、エージェントが英語版から翻訳し、確認しました。Zhehan が読めるのは英語と中国語です。校正へのご協力をお待ちしています。 校正に協力する 翻訳の問題を報告する
Grok Bot は、xAI のデスクトップ用エージェントアプリです。ルーティンとは、保存したタスクです。この接続では Webhook を使います。Webhook とは、SwB がルーティンを開始するために呼び出す Web アドレスです。
始める前に
対応しているパソコンに Grok Bot をインストールしてください。Grok Bot を含むプランでサインインしてください。
SwB の公開 HTTPS アドレスと、オーナーのサインインを設定してください。grok-routine ブロックを有効にしてください。SwB のプロジェクトを選んでください。OAuth では、ブラウザーでアクセスを承認します。
セットアップ用プロンプトをコピーする
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.SwB を追加したあと、このプロンプトを Bot のチャットに貼り付けてください。
Grok Bot を接続する
Bot を作成する
オンボーディングで作った Bot を使うか、サイドバーの + から New Bot を選択してください。名前を入力してください。Create を選択してください。
Connect apps を開く
サイドバーで Connect apps を開いてください。Add a custom connector を選択してください。
アドレスを入力する
Name に SwB と入力してください。Type で Remote HTTPS を選択してください。Server URL に https://swb.example.com/mcp と入力してください。Add plugin を選択してください。
サインインする
任意入力の OAuth クライアントの欄は空のままにしてください。Grok Bot が SwB のサインインを開いたら、オーナーとしてサインインしてください。アクセスを承認してください。
ルーティンを開く
Bot のチャットの Details からルーティンを開いてください。Webhook のトリガーを確認してください。
Webhook の URL を保存する
Webhook のアドレス用の受け取りリンクを開いてください。ルーティンの POST to をコピーしてください。Webhook URL に貼り付けてください。Save webhook url を選択してください。
キーを保存する
Webhook のキー用の受け取りリンクを開いてください。ルーティンの key をコピーしてください。Token に貼り付けてください。Save token を選択してください。
Grok Bot に伝える
Bot のチャットで、完了したことを伝えてください。すると、Grok Bot がルーティンをテストします。
エージェントの動作
オーナー権限を持つエージェントで connect(what="grok-bot") を呼び出してください。SwB は、MCP アドレス、OAuth の状態、ルーティン用のプロンプトを返します。このプロンプトは、Webhook の trust 欄を使って、ルーティンが対応できるリクエストを伝えます。ルーティンは reply で回答します。
このプロンプトでルーティンを作成するよう、Grok Bot に頼んでください。オーナー用クライアントで、connect(what="grok-bot", choose={"name":"<routine>","project":"<project>","auth":"key"}) を使ってルーティンを登録してください。SwB は、アドレスとキーについて別々の受け取りリンクを作ります。両方を保存したら、connect が返す send の呼び出しを実行してください。
ルーティンに送ると、SwB はその Webhook を呼び出してルーティンを開始します。
認証情報
| トークン | 表示される場所 | 形式 | 入力する場所 |
|---|---|---|---|
| Webhook の URL | ルーティンの Details の Webhook にある POST to | HTTPS アドレス | SwB の受け取りリンクの Webhook URL |
| Webhook のキー | ルーティンの Details の Webhook にある key | ランダムな文字列 | SwB の受け取りリンクの Token |
| SwB のサインイントークン | サインイン時に Grok Bot が受け取ります | ランダムな文字列 | Grok Bot が保管します |
受け取りリンクとは、1 つのトークンを入力するための、SwB の 1 回限りの非公開ページです。各値はそのページにだけ貼り付けてください。
接続を確認する
ルーティンの Details を開いてください。Webhook のトリガーを確認してください。オーナー用クライアントから、もう一度 connect(what="grok-bot") を呼び出してください。状態の行にルーティン名が表示されます。送信側のクライアントで inbox を確認し、テストの返信を探してください。
問題を解決する
OAuth のサインインに失敗したら、別の SwB のオーナー用クライアントでルーティンを登録してください。コネクターがベアラーキーを受け付ける場合は、ペアリング済みのキーを使ってください。
key の値をコピーしてください。既定のヘッダーでは、SwB が Authorization: Bearer を付けます。
ルーティンの開始には grok-routine:routine:<routine> を使います。Grok のメールボックスに送るときは agent:grok を使います。
受け取りリンクは 1 回だけ使えて、30 分で期限が切れます。新しいリンクが必要なときは、もう一度 connect を呼び出してください。保存した値を変えるときは、choose.replace を url か secret にして connect を呼び出してください。