Skip to content
首页

/

术语表

/

集成

/

Webhook

集成

3 分钟阅读

什么是 Webhook?

A webhook is an HTTP callback that automatically sends data from one application to another when a specific event occurs. Unlike polling an API repeatedly, webhooks push updates in real time the moment something happens.

What is a Webhook?

A webhook is an event-driven communication mechanism where one system sends an HTTP POST request to a pre-configured URL whenever a specific event occurs. Instead of your application repeatedly asking "has anything changed?" (polling), the source system proactively pushes data to you the instant something happens.

Think of it like the difference between refreshing your inbox every five minutes and having push notifications enabled. Webhooks are the push notification of the API world.

How Webhooks Work

  • Registration: You provide a destination URL (the webhook endpoint) to the source application and specify which events you want to receive (e.g., "order.created", "payment.completed").
  • Event occurs: When the specified event happens in the source system, it constructs a JSON payload containing the event details.
  • Delivery: The source system sends an HTTP POST request to your registered URL with the event payload in the body.
  • Processing: Your endpoint receives the request, validates it (often via a signature header), processes the data, and returns a 200 status code to acknowledge receipt.
  • Retry: If your endpoint is unreachable or returns an error, most webhook providers retry delivery with exponential backoff.
  • Webhooks vs. Polling

    AspectWebhooksPolling
    LatencyNear-instantDepends on poll interval
    Resource usageEfficient — only fires when events occurWasteful — constant requests even when nothing changes
    ComplexityRequires a publicly accessible endpointSimpler to implement initially
    ReliabilityDepends on retry logicGuaranteed to eventually fetch data
    ScalabilityScales well for high-event-volume sourcesCan hit rate limits with frequent polling

    Common Webhook Use Cases

  • Payment notifications: Stripe, PayPal, and other payment processors send webhook events for successful charges, refunds, disputes, and subscription changes.
  • CI/CD pipelines: GitHub webhooks trigger builds, tests, and deployments when code is pushed or pull requests are opened.
  • CRM updates: Salesforce or HubSpot webhooks notify downstream systems when leads are created or deal stages change.
  • E-commerce events: Shopify webhooks fire on new orders, inventory changes, or customer registrations.
  • Securing Webhooks

    Webhook endpoints are publicly accessible URLs, making security critical:

  • Signature verification: Most providers include an HMAC signature header. Verify it using your shared secret to confirm the request is authentic.
  • HTTPS only: Always use TLS-encrypted endpoints to protect data in transit.
  • IP allowlisting: Some providers publish their sending IP ranges for firewall rules.
  • Idempotency: Design your handler to safely process the same event more than once, since retries can cause duplicate deliveries.
  • 为什么重要

    Webhooks enable real-time automation that reacts instantly to events across your stack. Without them, you are stuck polling APIs on a schedule, wasting resources and introducing delays that can range from seconds to minutes. For time-sensitive workflows like payment processing or alerting, that delay is unacceptable.

    Autonoly 如何解决

    Autonoly provides managed webhook endpoints out of the box — no need to set up your own server. Register an Autonoly webhook URL in any service, and incoming events automatically trigger your workflows. Autonoly handles signature verification, payload parsing, retry acknowledgment, and passes the event data directly into your automation pipeline.

    了解更多

    示例

    • Triggering an order fulfillment workflow the instant a Shopify purchase is completed

    • Automatically creating a support ticket in Jira when a customer submits a form on your website

    • Sending a Slack notification when a GitHub pull request is merged into the main branch

    常见问题

    Most webhook providers implement automatic retries with exponential backoff. They will attempt to redeliver the event over a period of hours or days. You should design your endpoint to be idempotent so that processing the same event twice does not cause issues.

    An API is a request-response interface where your application initiates the call. A webhook is a reverse mechanism — the external service initiates the call to your application when an event happens. Webhooks are built on top of HTTP (the same protocol APIs use) but flip the direction of communication.

    别再只是阅读自动化了。

    开始自动化吧。

    用简单的中文描述您的需求。Autonoly 的 AI 智能体会为您构建并运行自动化 -- 无需编写代码。

    查看功能