Skip to content

Webhook Configuration

Webhooks allow Mahadata to send events in real time to your own HTTP endpoint — for example, when an incoming message is received, or when an outgoing message’s status changes to delivered, read, or failed. This feature is intended for developers who want to integrate the platform with internal systems (CRM, ticketing, automation) without having to poll.

You access this feature from Menu > Developer > Webhook (/developer/webhooks). This page requires the developer:manage_webhooks permission; without that permission, the Add Endpoint button and the delete button are disabled.

Webhook URL and event configuration
Webhook URL and event configuration

The main page displays all registered webhooks as expandable rows. Each row shows:

ColumnDescription
Endpoint URLThe HTTP address where events are delivered (displayed with a globe icon)
Authentication / secret badgeShows “OAuth 2.0” or “Bearer” when authentication is not HMAC. For HMAC webhooks without a signing secret (has_secret = false), displays a warning badge indicating no signing secret is configured
Event badgeOne badge per subscribed event (e.g. message.inbound)
Scope badgeShows restricted assets (WABA: ..., Phone: ..., Channel: ...) or All assets if unrestricted
Status badgeHealthy (green) or Failed (red) — see the note below

Each row includes actions: Send test event, Generate secret (to generate or rotate an HMAC whsec_... secret), Deliveries (opens the 7-day failed delivery log), and a delete button.

BadgeMeaning
HealthyThe webhook is active (is_active = true)
FailedThe webhook is inactive (is_active = false)

This badge reflects the webhook’s active/inactive state, not the outcome of the last delivery. To inspect actual delivery failures, open the Deliveries panel.

Click Add Endpoint to open the creation dialog. Available fields:

FieldRequiredDefaultDescription
Endpoint URLYes—The HTTP destination address. Must be a valid URL (e.g. https://api.myapp.com/webhook)
Verification TokenNo—Used for HMAC authentication (hub.verify_token handshake and payload signing). When omitted at creation, the platform automatically generates a secret (whsec_...) and shows it once
Events to deliverYes—At least one event must be selected (see the events table)
AuthenticationNoHMACAuthentication method used when the platform dispatches webhooks to your endpoint
ScopeNoAll assetsRestrict the webhook to specific WABAs, phone numbers, or channel types

Standard events are always available:

EventLabel
message.inboundInbound Message Received
message.status.sentMessage Sent
message.status.deliveredMessage Delivered
message.status.readMessage Read
message.status.failedMessage Failed
pwa_redirect_clickedPWA Chat Link Clicked / Redeemed
pwa_session_startedPWA Chat Session Started
pwa_message_sentPWA Visitor Message Sent
pwa_message_receivedPWA Reply Delivered to Visitor
pwa_push_deliveredPWA Web Push Notification Delivered
pwa_session_closedPWA Chat Session Closed

All six pwa_* events are sent in the standard ConversationWebhookPayload envelope (event, timestamp, client_account_id, conversation_id, contact, channel: { type: "webchat", id: "<widget_id>" }, and data):

{
"event": "pwa_redirect_clicked",
"timestamp": "2026-10-31T12:00:00Z",
"client_account_id": "00000000-0000-0000-0000-000000000000",
"conversation_id": "11111111-1111-1111-1111-111111111111",
"contact": {
"id": "22222222-2222-2222-2222-222222222222",
"phone_number": "+6281200000000",
"name": "Budi Santoso"
},
"channel": {
"type": "webchat",
"id": "33333333-3333-3333-3333-333333333333"
},
"data": {
"link_id": "44444444-4444-4444-4444-444444444444",
"visitor_id": "55555555-5555-5555-5555-555555555555",
"widget_id": "33333333-3333-3333-3333-333333333333",
"source_conversation_id": "66666666-6666-6666-6666-666666666666"
}
}

Details of the data object for each pwa_* event:

Eventdata Object Fields
pwa_redirect_clicked{ "link_id": "<uuid>", "visitor_id": "<uuid>", "widget_id": "<uuid>", "source_conversation_id": "<uuid|null>" }
pwa_session_started{ "visitor_id": "<uuid>", "widget_id": "<uuid>", "link_id": "<uuid|null>", "resumed": true | false }
pwa_message_sent{ "visitor_id": "<uuid>", "widget_id": "<uuid>", "message_id": "<string>", "message_type": "<string>", "text_preview": "<string>" }
pwa_message_received{ "visitor_id": "<uuid>", "widget_id": "<uuid>", "message_id": "<string>", "sender": "agent" | "bot", "text_preview": "<string>" }
pwa_push_delivered{ "visitor_id": "<uuid>", "widget_id": "<uuid>", "subscription_id": "<uuid>", "message_id": "<string|null>" }
pwa_session_closed{ "visitor_id": "<uuid>", "widget_id": "<uuid>" }

Advanced events appear when advanced_webhooks is enabled on your account:

EventLabel
template_status_updateTemplate Status Update
template_category_updateTemplate Category Update
template_quality_updateTemplate Quality Update
phone_number_quality_updatePhone Number Quality Update

Choose how Mahadata authenticates when delivering webhooks to your endpoint:

MethodAdditional fieldsHow it works
HMAC Signature (Default) (hmac)Verification Token (optional)The platform signs the exact raw payload bytes with the secret (whsec_...) in the X-Mahadata-Signature-256 header (or the account’s configured signature header). The secret is shown once when created or regenerated
OAuth 2.0 Client Credentials (oauth2_client_credentials)Token URL, Client ID, Client Secret, ScopesThe platform fetches an access token from your server and includes it with every delivery
Static Bearer Token (bearer_static)Bearer TokenThe static token is sent in the Authorization: Bearer <token> header on every delivery

OAuth 2.0 fields:

FieldDescription
Token URLYour authorization server endpoint (e.g. https://your-auth-server/oauth/token)
Client IDOAuth client ID
Client SecretOAuth client secret (masked)
ScopesSpace-separated list of scopes (optional, e.g. webhook.write)

By default, a webhook receives every event across all assets in the account. You can narrow the scope to any combination of the following:

Scope typeSelection source
WABATenant WABA list (GET /api/wabas)
Phone numberTenant non-placeholder phone numbers (GET /api/phone-numbers)
Channel typewhatsapp, rbm, telegram, line, email, webchat, instagram, facebook

Scopes use OR semantics: an event is delivered if it matches any of the selected scopes. When no scope is selected, the webhook applies to the entire account.

  • At creation: When no secret is provided when creating an HMAC webhook, the platform generates one (whsec_...) automatically. The confirmation dialog shows the signing secret with a copy button only once — save it immediately.
  • Generate secret in the portal: If an HMAC webhook has no signing secret (indicated by the no signing secret badge) or you want to rotate its secret, click Generate secret on the webhook row in Developer > Webhooks. A new whsec_... secret is generated and shown once, and all subsequent deliveries use the new secret.

Click Deliveries on a webhook to open the delivery log panel. This panel shows failed deliveries from the last 7 days. When there are no failures, the panel confirms that recent deliveries succeeded.

Each delivery entry displays:

ColumnDescription
Event typeType of event dispatched
Response statusFinal HTTP status code from your endpoint (including the final 5xx code after retries finish)
LatencyResponse time in milliseconds (if available)
AttemptsNumber of delivery attempts (up to 4 attempts: immediately, then after 5, 15, and 30 seconds for 5xx, timeouts, connection errors, 408, and 429)
TimeRelative time since the delivery attempt (e.g. “5m ago”)

Expanding an entry shows Failure Reason, Response Body, Request Payload (JSON), Matched scope (displays a TEST badge if the delivery came from a test event), and the Replay button.

  • Replay re-sends the exact same payload bytes with a fresh signature, the same signature header name configured for the account, and the same authentication headers (Authorization and custom headers) as the original delivery.
  • Replay is not available for OAuth 2.0 webhooks (oauth2_client_credentials) yet.

The Send test event button on each webhook triggers a sample event delivery to your endpoint. This button is disabled if the tenant has no active non-placeholder phone number.

Click the delete icon on the webhook row. A confirmation dialog appears before the webhook is permanently removed. This action requires the developer:manage_webhooks permission.