API Connections / Webhooks: let services notify your bot

Webhooks: let services notify your bot Intermediate

Instead of your bot checking over and over, a webhook lets a service tap your bot on the shoulder the moment something happens.

What you'll learn

  • What a webhook is
  • How receiving one works
  • Why you verify and reply fast

Before you start

1. Polling vs webhooks

Polling is asking "anything new?" every few minutes. A webhook is the service calling a web address you give it when something happens, like a new order or a shipping update. It's faster and uses fewer requests.

2. How it works

  1. You run a small web address (an endpoint) that can receive messages.
  2. In the service's settings, you register that address and choose events, like "order created".
  3. When the event happens, the service sends your endpoint a POST request with the details in JSON.
  4. Your code checks the signature, a code the service calculates with a shared secret, to prove the message is real.
  5. Your code replies quickly with a 200 status, then does the slow work afterward.
Screenshot: A store admin screen where a webhook URL and event are registered.

3. Why reply fast?

Services usually wait only a short time. If you're slow or fail, they may retry, so your code should handle the same event twice without doing the job twice.

4. Where you'll see webhooks

Shopify, WooCommerce, BigCommerce and many others offer them. See each platform guide in this section.

5. Let your bot help

Explain how to receive Shopify order webhooks on a Cloudflare Worker and verify the signature, using the official docs.

Ideas to try

  • Store owner.
    Help me set up a webhook so I get a message as soon as an order is placed.
  • Testing.
    Explain how to send a test webhook and check it arrived.
  • Reliability.
    Review my webhook code and tell me if it would double-process a retried event.
  • Shipping.
    Which carriers in this section offer tracking webhooks? Check their docs.

Tips

  • Always verify signatures; anyone can send a request to a public URL.
  • Log every event you receive.
  • Keep a polling backup in case webhooks stop.

Facts about the Grok Bot app come from Cursor's official Grok Bot documentation. See e.g. Shopify webhooks and WooCommerce webhooks. Menus and services change; if something looks different, check the official docs or ask your bot.