Guide: Configure Webhook via API
This endpoint allows you to configure and automatically verify a device webhook URL directly via the API using your Device Token.
How Automatic Verification Works
Upon receiving the request, the Wagy server will:
- Validate the URL and enforce SSRF protection (rejecting private IPs,
localhost, and internal network ranges). - Dispatch a GET challenge request to the target webhook URL:
GET <webhook_url>?challenge=<random_token>
- Your webhook server must respond within 5 seconds with HTTP
200 OKand echo thechallengequery parameter value in the response body (as plain text or JSON{"challenge": "<random_token>"}). - Upon receiving the matching challenge response, Wagy marks
webhook_verifiedas true and generates a freshwebhook_secret(HMAC-SHA256). - If verification fails, the request is rejected and the previous webhook configuration is preserved (auto-rollback).
HMAC-SHA256 Security
Store the returned webhook_secret securely. It is used to verify the X-Wagy-Signature header on every incoming webhook event payload sent by Wagy to your server.
Set device webhook URL
PUT/:device_id/webhook
Automatically configure and verify webhook URL to receive incoming messages (inbound) and message delivery status updates.
Request
Responses
- 200
- 400
- 401
- 404
- 500
Webhook berhasil dikonfigurasi dan diverifikasi
URL webhook tidak valid, terdeteksi IP privat/localhost (proteksi SSRF), atau gagal merespons uji verifikasi (challenge response)
Tidak terautentikasi (Token perangkat tidak valid)
Perangkat tidak ditemukan
Terjadi kesalahan internal server