Module 06Lesson 4

Lesson 4. Webhook — Real-Time Notifications

Hands-on: Zapier

Lesson 4. Webhook — Real-Time Notifications#

Why This Matters#

A webhook is a way to receive notifications from a service when something happens. For example, when a client pays for an order, the payment system sends a webhook to your bot.

Key Idea#

Webhook = "call me when something happens"

Instead of constantly asking "is the order paid?", you give the service your address, and it notifies you itself.

How Webhooks Work (Analogy)#

Usual way (polling):

You call the store every 5 minutes: "Is my order ready?"

→ You waste time and nerves

Webhook:

You tell the store: "When the order is ready, call me at this number"

→ The store calls you when it's ready

Webhook Example in Integration#

Scenario: payment via Stripe → notification in Telegram

  1. Client pays for an order on the website (via Stripe)

  2. Stripe sends a webhook to your server:

    • "Order #123 paid, client — Ivan, amount — 5000 rubles"
  3. Your server receives the webhook and sends a notification to the manager in Telegram

  4. The manager sees: "New payment! Order #123, Ivan, 5000 rubles"

Webhook vs API#

CharacteristicAPI (request)Webhook (notification)
Who initiatesYou ask the serviceThe service notifies you
When it triggersWhen you send a requestWhen an event occurs
Example"Show me the list of orders""New order created"

What You Need for Webhooks#

  1. Receiving URL — address where the service will send notifications

    Example: https://your-bot.com/webhook

  2. Service configuration — specify which events to send

    Example: "Send webhook on new order, payment, cancellation"

  3. Webhook handler — code or automation that reacts to the notification

Webhook Use Cases#

In business:

  • Client paid → send receipt and start order fulfillment

  • New form submission on website → create lead in CRM

  • Product out of stock → notify manager

In AI agents:

  • Client messaged the bot → webhook activates the agent

  • Agent collected data → webhook sends it to CRM

  • Lead qualified → webhook notifies manager