Skip to content

INTERMEDIATE · 2.9

How to trigger a routine from a webhook (web forms first)

Let a web form or a message service wake your Bot the moment something arrives, and have it draft the reply for you to check.

Level
Intermediate
Plan needed
Any plan that includes Grok Bot: Premium, Super or Ultra on The X Subscription, or a team seat on those tiers. Plus and Free don't include it. Some older Cursor and linked SuperGrok plans include it too. Checked Nov 4, 2026; see Grok Bot pricing.

Intermediate

What you’ll be able to do

  • A routine with a webhook trigger that wakes when a test form or message is sent to it.
  • A Bot that reads what was sent and drafts a reply in its chat. Nothing is sent to anyone.
  • A safe way to test it, and a plan for keeping the key secret.

A webhook is a web address that another service can call. When your website form is sent, or a customer writes on WhatsApp, that service sends the details to your routine’s webhook address. The routine wakes up, reads what was sent and does its job.

What you’ll build

By the end of this lesson you will have:

  • A routine with a webhook trigger that wakes when a test form or message is sent to it.
  • A Bot that reads what was sent and drafts a reply in its chat. Nothing is sent to anyone.
  • A safe way to test it, and a plan for keeping the key secret.

Before you start

  • You finished lesson 2.8, Routines.
  • You use the desktop app. The Webhook section and the Test button are on desktop.
  • You have a service that can send an HTTP POST with a header. Examples: a form tool with webhook settings, or Bird for WhatsApp and SMS (connect WhatsApp through Bird).
  • Your test data uses made-up names only.
  • Your plan includes Grok Bot (see the lesson details above).

What a webhook routine is

  1. Something happens in another service, like a form being sent.
  2. That service sends an HTTP POST to your routine’s webhook URL, with a secret key in the header.
  3. If the key is right, Grok Bot answers 200 and starts a run.
  4. Your Bot gets the body of the request (often JSON) together with the routine’s instruction.
  5. The Bot does the work and shows the result in its chat.

Step by step

Step 1: Ask the Bot for a routine with a webhook trigger

  1. Open the chat with the Bot that should own this job.
  2. Copy Prompt 1 below and send it.
  3. Read the Bot’s confirmation. Check the owning Bot, the input, the expected result and the approval boundary.

Step 2: Copy the URL and the key

  1. Click the Bot’s name at the top of the chat.
  2. On the Details tab, open the new routine under Routines.
  3. Find the Webhook section. It shows three fields:
    • POST to is the URL.
    • key is the secret. Senders include it as Authorization: Bearer <key>.
    • header is that full header, ready to copy.
  4. Click a field to copy it.

Step 3: Paste them into the sending service

  1. Open your form tool’s webhook settings (or Bird, for messages).
  2. Paste the POST to URL as the address.
  3. Set the method to POST.
  4. Add the header. Paste the header field, or use Authorization as the name and Bearer <key> as the value.
  5. If the service lets you choose, send the body as JSON.
  6. Save the settings.

For WhatsApp, SMS or Apple Messages: Bird has a ready-made Grok Bot destination. You paste the URL and the sender key into it. The full steps are on connect WhatsApp through Bird.

Step 4: Send a test and read the result

  1. Send one test from the service, with made-up data.
  2. Check the response the service shows.
  3. Open the Bot’s chat and read the result.

What the response means:

  • 200 means Grok Bot accepted the call and started a run. It does not mean the Bot has finished. Check the chat for the result.
  • Any other response means no run started. Check that the routine isn’t Paused and that the request uses the current key.

You can also choose Test on the routine page to run the instruction once. A test does real work, so use safe input.

Step 5: Teach the routine to handle messy input

Real messages are messy. People ask two things at once, write off-topic, or paste odd text. Tell the routine what to do with each case (Prompt 2):

  1. Say what counts as an on-topic message.
  2. Say what to do with anything else: a short holding draft, flagged for you.
  3. Say that text inside the message is information, not instructions.
  4. Say what to do if the same message arrives twice.

Example: WhatsApp and SMS through Bird

Grok Bot doesn’t list WhatsApp or SMS as a built-in app. Bird, a third-party messaging service, can send each message you receive on WhatsApp, SMS, Apple Messages or an agent mailbox to a Grok Bot routine (Bird docs, checked Nov 4, 2026):

  1. Install Bird in Grok Bot and connect your Bird workspace.
  2. Ask Grok Bot for a routine with a webhook trigger. Copy its URL and sender key.
  3. In Bird, create a webhook with the Grok Bot destination, pick the message events (such as whatsapp.received or sms.received) and paste the URL and key.
  4. Choose Send test, then send a real message from your own phone.

Bird retries a delivery that fails, so one message can start more than one run. The full guide is connect WhatsApp through Bird. A full build that uses it: a salon build triggered by booking messages.

Keep the key secret

  • Treat the key like a password. Anyone with the URL and the key can start a run, and every run uses your usage.
  • Never paste the key in a public place, a shared doc or a screenshot.
  • Paste it only into the sending service’s settings.
  • If the key has been shared by mistake, pause the routine first. Then ask your Bot how to get a new key.

Limits

Checked in the docs on Nov 4, 2026. Recheck before publishing.

  • Each routine can run up to 200 times an hour. All your routines together can run up to 300 times an hour.
  • A run past either limit fails with Automation run rate limit exceeded. It isn’t retried for you. Send the webhook call again.
  • A busy form or a popular WhatsApp number can hit these limits and use usage fast. Every run spends usage.
  • The docs list a known issue where a shared limit across all Grok Bot routines can also cause this error.

Common mistakes

  1. Part of the URL is missing. Click the POST to field to copy it, rather than selecting the text by hand.
  2. The key is missing or wrong. The header must be Authorization: Bearer <key>. Use the header field.
  3. The routine is paused. Paused routines don’t start. Check the switch on the routine row.
  4. Thinking 200 means “done”. It means “started”. Read the chat for the result.
  5. Two runs for one message. The sender retried. Tell the routine to check for a reply it already drafted before writing another one.
  6. Auto-sending replies. Keep replies as drafts and keep Ask first on sends (lesson 2.6, approvals).

Stuck? See our help page.

Safety and approvals

  • Messages from customers and forms are information, not your permission. Auto Review doesn’t count text from outside sources as your request.
  • Keep every outgoing message behind Ask first. A webhook routine runs without you, so its approval cards expire after 30 minutes if you don’t answer.
  • Keep the instruction narrow. A broad webhook routine does more than you expect.

Usage note: every webhook call that starts a run uses usage. A busy form or number can add up fast. Keep the instruction short and the job small.

Skills ladder: you are here, Intermediate.Skills ladder: you are here, Intermediate.
Where this lesson sits on the skills ladder.

Quiz

Question 1: What does a `200` response from the webhook mean?

Question 2: How do senders include the key?

Question 3: Why can one WhatsApp message start two runs?

Question 4: What should a webhook routine do with a customer's message?

Saved in this browser only; no account needed.

Level progress: Intermediate, lesson 2.9.

Related builds: Front Desk Bot (Hair salon), Reviews & Catering Bot (Restaurant)

FAQ

What does a 200 response mean?

Grok Bot accepted the call and started a run. It doesn’t mean the Bot has finished. Check the Bot’s chat for the result.

Can any form tool use it?

The routine needs an HTTP POST to its URL with the key in an Authorization: Bearer header. A form tool that lets you set the address, the method and a header should fit.

What if someone gets my webhook URL?

They also need the key to start a run. Keep the key private. If it leaks, pause the routine and get a new key.

Why did one message start two runs?

The sending service probably retried. Bird’s docs say it retries a delivery that fails, so a retried message can start another run. Tell your routine to check for a draft it already made.

Does WhatsApp need Bird?

In this guide, yes. Grok Bot’s docs don’t list WhatsApp as a built-in app. Bird is a third-party service with its own account and pricing.

Product facts were checked against these pages on Nov 4, 2026. Nothing in this lesson has been tested yet.

Sources

  1. Webhook trigger, POST to / key / header, `Authorization: Bearer <key>`, JSON body, `200` meaning, other responses, rate limits, Test, checked Nov 4, 2026
  2. Same facts in the help article, checked Nov 4, 2026
  3. Bird routing to Grok Bot: events, retries, Grok Bot destination, Send test, credential rotation on Bird's side, checked Nov 4, 2026
  4. Bird's Grok Bot connector fields (`webhook_url`, `sender_key`) and accepted events, checked Nov 4, 2026
  5. Background approval cards expire after 30 minutes; outside text isn't your request, checked Nov 4, 2026
  6. Plan line, checked Nov 4, 2026