Skip to content

Webhook Configuration

Webhooks allow Sangho to notify your server in real time when events occur on your account. You can create and manage your endpoints from the dashboard or via the Webhooks API.

Create an endpoint from the dashboard

  • 1. Go to Dashboard → Developers → Webhooks.
  • 2. Click Add an endpoint.
  • 3. Enter your server's HTTPS URL.
  • 4. Select the events to listen for (or All events).
  • 5. Click Create — copy the webhook_secret shown only once.

Endpoint requirements

  • Valid HTTPS URL (HTTP rejected except localhost in Sandbox).
  • HTTP 200 response within 30 seconds.
  • Response body is ignored — only the HTTP status code matters.
  • Endpoint must be publicly accessible from the internet.
Respond 200 immediately

Always respond HTTP 200 immediately, even if business processing fails. Handle errors in the background to avoid unnecessary redeliveries. See the Idempotency guide for handling duplicates.

Minimal endpoint (Express)

javascript
const express = require('express');
const app = express();


// IMPORTANT: use express.raw, not express.json
app.post(
  '/webhook',
  express.raw({ type: 'application/json' }),
  (req, res) => {
    const event = JSON.parse(req.body);
    console.log('Event received:', event.type);


    // Process in background, respond immediately
    processEvent(event).catch(console.error);


    res.status(200).json({ received: true });
  },
);

Retry policy

If your endpoint does not respond 200 within 30 seconds, Sangho retries delivery 10 times with exponential backoff.

AttemptCumulative delay
1Immediate
2+5 min
3+15 min
4+30 min
5+1 h
6+2 h
7+4 h
8+8 h
9+16 h
10+24 h then +48 h

Test an endpoint

From an endpoint’s detail page in the dashboard, click Send a test event. Select the event type and Sangho sends a real payload to your endpoint. You can also do this via the API:

Local tunnel for testing

To test your endpoint during local development, use ngrok or localtunnel to expose your local server via a public HTTPS URL.

Send a test event (API)

bash
curl -X POST https://api.sangho.ga/v1/webhooks/wh_xxx/test/ \
  -H "Authorization: Bearer sk_prod_xxxx" \
  -H "Content-Type: application/json" \
  -d '{ "event_type": "payment_intent.succeeded" }'
Response200 OK — Test event sent
Sangho sends a real payload to your endpoint. Check your delivery logs to confirm receipt.
json
{
  "id": "evt_test_xxxxxxxxxxxx",
  "object": "event",
  "type": "payment_intent.succeeded",
  "livemode": false,
  "test": true,
  "created_at": "2026-03-01T10:00:00Z"
}