Grok Bot

Connect a Grok Bot agent to the HITLy inbox over MCP - approvals, typed questions, and wake-up webhooks through registered callbacks.

Grok Bot agents can ask a human before they act. HITLy does not run inside Grok — the agent calls the HITLy MCP connector, the ask lands in the HITLy inbox, and the agent carries on once a person has decided. Nothing about how you build or host the bot changes: it keeps its own runtime, tools and memory, and HITLy is only the human gate in front of the actions you do not want it taking unattended.

What you get

  • Approvals in your inbox. The agent calls request_approval; the card shows the question, the action and its arguments, and the risk. A person approves, rejects or ignores it.
  • Typed answers, not chat. The agent calls ask_user with an answer schema (text, single, multi, number) and gets that exact type back — no free-text interpretation.
  • Wake-up webhooks. Register the bot's callback URL once under Project → Callbacks and HITLy POSTs the outcome the moment a human decides, authenticated from the registration. No secret in the prompt, no polling loop.
  • One reviewer UI. The same inbox card you use for Mastra, Hermes or HTTP callers.
  • No decide tool. The bot can request, read and cancel. It can never approve its own action — decisions come only from a signed-in human.

Before you start

  1. A HITLy account and project. On HITLy Cloud, create an account at cloud.hitly.net. Self-hosting is open source.
  2. A project on the HTTP plugin. The connector's asks are ordinary HTTP-plugin project requests, so the project has to run that plugin — a project on Mastra, Hermes or n8n answers Plugin mismatch. If you will connect with a project API key instead of signing in, create or copy it under Project settings → Config; keys start with hitly_.
  3. A Grok Bot agent you can configure — one where you can add a custom MCP connector and set standing instructions.
  4. A public https callback endpoint (recommended). Anywhere the platform exposes a webhook routine the bot can be woken on. Private and loopback addresses are refused, and redirects are not followed.

Connect HITLy to Grok Bot

There are two ways to give the connector credentials. Pick one.

Sign in to HITLy Cloud (OAuth)

On HITLy Cloud the connector speaks OAuth, so there is no key to paste:

  1. In Grok Bot, add a custom MCP connector pointing at https://mcp.hitly.net/mcp and name it HITLy - the icon comes from the server itself, but the name is yours to set, and HITLy is what your team should see in the connector list. It signs in as client ID grok-bot and asks for the one scope the endpoint serves, hitly.mcp. Grok Bot is pre-registered with HITLy Cloud, so there is nothing to register and no client secret to paste; the connector discovers the sign-in endpoints on its own - see OAuth sign-in.
  2. The connector opens HITLy sign-in. Sign in with the account that administers the project the bot will work in.
  3. On the consent screen, pick the project. Consent is an admin act: you only see projects you administer, and archived ones never appear. Keep a bot to the single project it needs.
Grok Bot connector settings with the HITLy MCP connector added
Add the HITLy connector in Grok Bot's connector settings.
HITLy sign-in page shown while connecting the Grok Bot connector
HITLy sign-in, reached from the connector.
HITLy consent screen listing administered projects with one selected
Consent: choose the project this bot may use.

Connections you have granted are listed under Settings → Integrations, where you can revoke one. Revoking stops the bot's tool calls; open requests stay readable and decidable in the inbox.

Pass a project API key in the header

Use this for a self-hosted HITLy MCP server, or wherever the connector lets you set headers and you would rather not sign in. Add a custom MCP connector with the URL and the key in the Authorization header (name the connector HITLy as well):

{
  "mcpServers": {
    "hitly": {
      "url": "https://mcp.hitly.net/mcp",
      "headers": { "Authorization": "Bearer <your-project-api-key>" }
    }
  }
}

Substitute your own MCP host when you self-host, and use the project API key you copied in Project settings → Config. The key is a requester credential for that project: it can create, read and cancel asks, and it can never decide one. Treat it as a secret — anyone holding it can ask your reviewers on that project's behalf. Rotate it from the project settings if it leaks.

Verify the connection

Give the bot a prompt that forces an ask, and watch both sides:

  1. Ask the bot: Use HITLy to ask me to approve saving a draft reply to order 1842.
  2. The bot calls request_approval and gets requestId with state: "pending" straight back — it does not block.
  3. Open the HITLy inbox. The card is there: question, action name and arguments, the risk, and the deadline.
  4. Approve it. If the bot passed a callback_url, it is woken; otherwise it finds the answer by polling get_decision.
  5. The bot repeats the outcome — the approved action, or the reviewer's amended arguments.
HITLy inbox showing the pending approval from the Grok Bot agent
The ask lands in the HITLy inbox: question, action, arguments, risk, deadline.

If the card never appears, work through Troubleshooting before touching your prompt.

The tools the bot sees

The connector exposes exactly five tools. MCP server → Tools has the full schemas; what matters when you are driving Grok Bot is this:

Grok Bot showing the connected HITLy tools
Once connected, the bot sees five HITLy tools.
ToolWhat the bot uses it for
request_approval"May I do this?" — a human approves, rejects or ignores the action and its arguments.
ask_user"What do you want here?" — one question, one typed answer (text, single, multi, number).
get_decisionReads the outcome. The only source of truth: pending, expired and cancelled are never approval.
list_pending"What is still waiting on a human?" — useful on waking, or to sweep up before ending a run.
cancelWithdraws an ask that no longer matters, so the reviewer is not bothered with it.

Notes worth putting in front of the model:

  • request_approval needs question (one sentence, at most 160 characters, ending with ?), action ({ name, args }) and an idempotencyKey. Add risk, context (Markdown for the reviewer), reasonRequired, and up to 20 https links. links with mustOpen gate Approve/Reject until the reviewer has opened them — HITLy never fetches them itself.
  • ask_user answers exactly one question per request. A multi-field form is refused: simple_form comes back as an error telling the bot to send one ask_user per field.
  • get_decision returns status plus either the decision (value, reason) or the typed answer object { kind, value }. When the reviewer amended the arguments, editedArgs holds the full merged set — the bot must act on those, not on what it originally sent.
  • Expiry is never approval. Omit deadline and the host falls back to the matched rule's SLA, then the project's default timeout, then 24 hours; an explicit deadline always wins and is never clamped down (future, at most 30 days out).

Getting the answer back

Creating an ask returns immediately. Two ways to learn the outcome — the bot can use both.

Poll (works with no setup)

get_decision with the requestId, every 30–60 seconds with backoff, until the deadline. This is the fallback when the bot has no public callback URL, and it is what confirms any outcome the callback only hints at.

Webhook push (register the callback once)

Register the bot's wake-up URL so HITLy can authenticate the delivery from the registration instead of from a secret the bot has to carry around:

  1. Create the webhook routine in your Grok connector plugin and copy its URL and the signing secret the platform shows you.
  2. In HITLy, open Project → Callbacks, paste the URL, choose the auth mode the platform uses — Bearer token, Standard Webhooks, or GitHub X-Hub-Signature-256 — paste the secret, and save.
  3. Tell the bot to pass that exact URL as callback_url. No cb_auth_token needed.
HITLy project Callbacks page with a registered callback
Project → Callbacks: the URL and secret are stored once, per project.

The rules that matter:

  • The match is exact. Scheme, host, port, path and query all have to be identical, trailing slash included. https://example.com/hooks/hitly does not match https://example.com/hooks/hitly/. Registration is checked at delivery time, so registering after the ask was created still works.
  • Up to 20 callbacks per project, secret at least 16 characters. The secret is write-only: after saving you see the id, a redacted URL, the auth mode and a fingerprint — never the secret again.
  • Unregistered URLs still work, but only arrive authenticated if the bot passes its own cb_auth_token (16–512 characters), which HITLy sends back as authorization: Bearer …. If a per-request token and a registered bearer secret both exist, the per-request token owns the authorization header.
  • Verify the delivery. Alongside the scheme's own headers, HITLy sends x-hitly-timestamp, x-hitly-signature, x-hitly-event-id and x-hitly-key-id when webhook signing is on. Dedupe on x-hitly-event-id — retries reuse it. HTTP → Registered callbacks and MCP → What the POST looks like cover the full body and signature check.
  • Delivery semantics. Any 2xx is acceptance. 5xx, 429, 408 and 425 are retried; other non-2xx fail immediately; redirects are not followed; private and loopback destinations are refused. A delivery that ultimately fails shows callbackDelivery: "failed" on get_decision — the human's decision still stands, so read it.

No callback_url means no callback at all: no POST, no auth, no signature, and nothing shows as failed. A bot that skips the URL must poll.

Tell the bot how to behave

MCP servers send the client a short set of instructions, and the HITLy server sends these verbatim:

HITLy routes asks to a human reviewer. request_approval and ask_user return immediately (pending). Never treat pending, expired or cancelled as approval. Confirm with get_decision before acting; if editedArgs is present, act on those. The typed ask_user answer comes back from get_decision as answer {kind, value}; use it verbatim. callback_url (https, with optional cb_auth_token sent back as Authorization: Bearer) gets a POST when the outcome is known, but the callback is only a hint - get_decision is the source of truth; if you don't pass callback_url you won't receive a callback, so poll get_decision. Ask one question per ask_user request (hitl/v0 answers exactly one ask); simple_form is refused with an error - send a separate ask_user for each field.

Clients that surface server instructions apply them automatically. Grok Bot builds that do not — or where you want the rules to survive a compaction of the conversation — put them in the agent's standing instructions, plus the bits specific to your deployment:

  • When to ask. Name the actions that must go through HITLy: sending email, spending money, deleting data, contacting a customer, pushing to production. Everything else runs unattended.
  • Never decide for yourself. Do not treat pending, expired or cancelled as a yes, and do not proceed on the callback alone — call get_decision first.
  • One question per ask. Send a separate ask_user per field rather than a form.
  • Reuse idempotencyKey. A stable key (bot id + task + action + arguments) means a retry returns the same request instead of asking the human twice.
  • Say where you are. After creating an ask, the bot should tell the user it is waiting for a reviewer and include the reviewUrl, not go quiet.
  • Timebox it. If the deadline passes, stop and report that approval did not arrive.

Worked example: an email that needs approval

A support bot drafts a reply to a customer and must not send it unsupervised.

The bot calls:

{ "name": "request_approval", "arguments": {
    "idempotencyKey": "reply-ticket-4821-v1",
    "question": "Send the drafted reply to customer 4821?",
    "action": {
      "name": "send-email",
      "args": { "to": "customer@example.com", "subject": "Your replacement mug", "body": "Hi — your replacement ships today." }
    },
    "risk": "high",
    "reasonRequired": ["reject"],
    "context": "Draft generated from ticket 4821. Policy: refunds and apologies under GBP 50 auto-drafted.",
    "links": [{ "url": "https://example.com/tickets/4821", "label": "Ticket 4821", "mustOpen": true }],
    "callback_url": "https://example.com/hooks/hitly"
} }

The bot gets back, immediately:

{ "requestId": "req_7f3a…", "state": "pending", "replayed": false,
  "argsHash": "b64url-sha256-of-args", "deadline": "2026-12-01T09:00:00.000Z",
  "callback": true, "reviewUrl": "https://cloud.hitly.net/inbox/req_7f3a…" }

It tells you it is waiting for a reviewer and stops. A person opens the card — the mustOpen link gates Approve and Reject until they have read the ticket — edits the greeting, and approves. Because the URL was registered, HITLy POSTs to it authenticated by the registration:

{ "event_id": "evt_…", "type": "decided", "request_id": "req_7f3a…", "id": "req_7f3a…",
  "occurred_at": "2026-11-30T10:04:00.000Z", "state": "decided", "decision": "edit",
  "editedArgs": { "to": "customer@example.com", "subject": "Your replacement mug", "body": "Hi Sam — your replacement ships today." },
  "argsHash": "b64url-sha256-of-args", "metadata": {} }

On waking, the bot calls get_decision for req_7f3a…, sees status: "answered" with the same editedArgs, and sends the edited body — not its original draft. It ignores argsHash mismatch alarms: that hash always describes the arguments as first sent.

Had the reviewer rejected instead, the callback would carry decision: "reject" with their reason, and get_decision would answer value: "reject" — so the bot sends nothing. Had nobody answered, the deadline would pass and the status would be expired — still not a yes.

Troubleshooting

SymptomCauseFix
The bot sees no HITLy toolsConnector saved but not connected, or OAuth consent not completedReconnect and finish the consent screen; confirm the URL ends in /mcp.
401 / unauthorizedMissing, wrong or rotated key; wrong projectRe-copy the key from Project settings → Config. Requests created with an old key are not readable with a new one.
Ask never appears in the inboxWrong project selected, or the project is paused/archivedCheck the consent screen's project and the project status. Paused and archived projects refuse new asks with project paused / project archived.
Plugin mismatch: expected …The connector files HTTP-plugin asks, so the project has to be on the HTTP pluginSwitch the project's plugin on Project settings → Config, or point the bot at a project that is already on HTTP.
Bot waits forever, nothing arrivesNo callback_url, or the callback failedThe bot must poll get_decision when it passes no URL. With a URL, check callbackDelivery: "failed".
Callback never POSTs though a URL was passedURL not registered and no cb_auth_token, or the endpoint is http, private, loopback, or redirectsRegister the URL exactly (trailing slash matters) with its auth mode, or pass cb_auth_token; serve a public https endpoint that answers 2xx directly.
401/403 at your endpointRegistered auth mode does not match what your endpoint verifiesMatch the mode — Bearer token, Standard Webhooks, GitHub X-Hub-Signature-256 — and re-enter the secret the platform showed you.
The bot acted without approvalIt treated pending as a yes, or acted on the callback without confirmingPut the standing instructions in the agent: confirm with get_decision before acting.
simple_form is refusedThe bot asked several questions in one ask_userOne ask_user per field.
not_supported_by_host from list_pendingSelf-hosted host without a key-scoped pending listPoll get_decision for the request ids the bot already holds.
unauthorized from cancelSome hosts do not allow API-key requester cancelLeave the ask to expire, or cancel from the web app.
Duplicate cards for the same taskA new idempotencyKey on every retryReuse a stable key derived from bot id, task, action and arguments.

Security notes

  • The bot can never approve itself. There is deliberately no decide tool; only a signed-in human in the HITLy web or mobile inbox can decide. Keep it that way by never letting an agent call your HITLy API with a reviewer's credentials.
  • A key is a requester credential. It can create, read and cancel that project's asks. Keep it out of prompts, repositories and client-side code; rotate from project settings if it leaks. Prefer the OAuth connection on HITLy Cloud, and revoke grants you no longer use under Settings → Integrations.
  • Scope each bot to one project. Consent lists only projects you administer; granting a broader project than the bot needs widens what a compromised agent can submit to your reviewers.
  • Treat the callback as a hint. Anyone who can reach your endpoint can send it a body; authentication headers and signatures prove provenance, not truth. Always get_decision before acting, verify signatures when signing is enabled, reject timestamps more than five minutes off, and dedupe on x-hitly-event-id.
  • Secrets are write-only by design. Registered callback secrets and cb_auth_token are never echoed back. If you lose one, re-enter the value the platform gave you — there is no way to read it out of HITLy.
  • context reaches a human screen. Do not put API keys, tokens or other people's personal data in it; it is stored with the request and shown to whoever reviews it.
  • Use mustOpen for the evidence that matters, and remember HITLy never fetches links — the reviewer's browser does.
  • Deadlines bound the risk. Set one for anything time-sensitive; expiry is a stop, not a green light.

On this page