Skip to main content

What it is

Webhooks are HTTPS requests that YCloud sends to your application when message delivery, inbound messages, contacts, templates, calls, and other resources change.

Before you begin

  • Store your YCloud API key in YCLOUD_API_KEY.
  • Deploy a publicly reachable HTTPS endpoint.
  • Preserve the raw request body for signature verification.
  • Decide which event types your application needs.

How it works

  1. Create a Webhook endpoint and subscribe it to event types.
  2. Store the returned endpoint secret.
  3. YCloud sends an event request to your endpoint.
  4. Verify YCloud-Signature before trusting the request.
  5. Return a 2xx response promptly.
  6. Process the event idempotently, because delivery may be repeated.

Request

Create an endpoint with POST /webhookEndpoints.

Request fields

Example request

Subscribe to echo and handover events

For Agents onboarded through the Public REST API, create an endpoint with the following subscriptions. Console-created Agents do not emit these three events. To change an existing endpoint, preserve any event subscriptions you still need.
The two echo event types carry a standard message-shaped whatsappMessage payload. The handover event carries whatsappMetaBusinessAgent and retains its Agent/control information. They do not use the WhatsApp Business App whatsapp.smb.message.echoes contract. See echo and handover event details for field definitions, examples, ordering, and handover correlation limits.

Response

The response returns the created endpoint and its signing secret. Store the secret securely. YCloud uses it to generate Webhook signatures.

Example response

Response fields

Receive events

Event request

YCloud sends a JSON event object to the configured url. The event includes common fields such as id, type, apiVersion, and createTime, plus a type-specific payload. Your handler should:
  1. Read the raw request body.
  2. Validate the YCloud-Signature header with the endpoint secret before trusting the payload.
  3. Return a successful 2xx response promptly.
  4. Move slow processing to a queue.
  5. Make event processing idempotent so repeated delivery does not repeat business actions.
Do not parse or modify the request body before signature validation. Use the exact raw bytes received by your server.

Receiver response

Return a successful 2xx HTTP response as soon as the signature and request are accepted. The response body can be empty.
Move slow business processing to a queue. A timeout or non-2xx response can cause YCloud to retry the event, so deduplicate by event id.

Common payload examples

Expand an event to inspect its complete example payload. These examples come from the OpenAPI webhook specification. See all webhook payload examples for every supported event type.
Example payload when contact attributes are changed
Example payload when a new contact is created
Example payload when a contact is deleted
Example payload when a customer cancels subscription
Example payload when a customer resumes subscription
Example payload when a WhatsApp template is archived
Example payload when a WhatsApp template is unarchived. The template status is the current status returned by Meta and does not represent a new approval review.
Example payload when a WhatsApp call is connected
Example payload when a WhatsApp call is terminated
Example payload when a WhatsApp call status is updated
See Webhook event payloads for the complete Event schema and interactive payload reference.

Rotate the endpoint secret

Rotate a secret if it is exposed or as part of your security policy:
Deploy the new secret to your receiver immediately after rotation.
An endpoint that repeatedly fails to receive notifications can move to pending status and stop receiving events. Monitor webhook failures and endpoint status.
For signature verification code, retry intervals, and receiver implementation, see Implement a webhook receiver.