Skip to content

Webhooks

Webhooks notify your services about real-time events in Netasampark so you can trigger downstream automation instantly.

Supported Events

  • message.delivered – Outbound message reached the recipient.
  • message.failed – Delivery failed with a provider error code.
  • campaign.enrolled / campaign.completed – Voter entered or finished a journey.
  • grievance.created / grievance.resolved – New grievance logged or resolved.
  • wallet.debited / wallet.credited – Wallet balance updates for billing.

Endpoint Setup

  1. Create an HTTPS endpoint capable of handling POST requests with JSON payloads.
  2. In the admin panel, navigate to Developer Settings → Webhooks.
  3. Register the endpoint URL, select events, and specify a shared secret.
  4. Validate the sample payload delivered during registration.

Security

  • Every webhook request includes an X-Netasampark-Signature header (HMAC-SHA256).
  • Verify signatures by hashing the request body with the shared secret.
  • Reject requests that fail signature validation or exceed the replay window (default 5 minutes).

Retry Policy

  • Netasampark retries failed deliveries up to 6 times using exponential backoff (1 min → 32 min).
  • HTTP 2xx is considered success; 4xx/5xx triggers a retry.
  • After the retry window, failed deliveries appear in the admin dashboard for manual review.

Example Payload

json
{
  "id": "evt_01HXYZ9C8FQJ3",
  "type": "message.delivered",
  "created_at": "2025-11-08T07:15:00Z",
  "data": {
    "message_id": "msg_01HXYZ8NSA2V7",
    "channel": "whatsapp",
    "recipient": "+911234567890",
    "campaign_id": "cmp_2PWA2025"
  }
}

Store the event ID to de-duplicate retries and confirm processing.