Skip to content

feat: POST /api/routes-b/webhooks/[id]/ping — send test ping to webhook#503

Open
kehindefaith26 wants to merge 1 commit intodavedumto:mainfrom
kehindefaith26:feat/webhook-ping-endpoint
Open

feat: POST /api/routes-b/webhooks/[id]/ping — send test ping to webhook#503
kehindefaith26 wants to merge 1 commit intodavedumto:mainfrom
kehindefaith26:feat/webhook-ping-endpoint

Conversation

@kehindefaith26
Copy link
Copy Markdown

Closes #478

What changed

Adds app/api/routes-b/webhooks/[id]/ping/route.ts with a POST handler that sends a signed test ping to a registered webhook's target URL.

How it works

  • Authenticates the request via Bearer token (Privy)
  • Looks up the UserWebhook by id and verifies ownership
  • Builds a { event: 'ping', timestamp, webhookId } payload
  • Signs it with HMAC-SHA256 using the webhook's signingSecret
  • POSTs to webhook.targetUrl with X-LancePay-Signature: sha256=<sig>
  • Returns { success, statusCode, targetUrl } — non-2xx responses set success: false, network errors set statusCode: 0

Acceptance criteria covered

  • 200 with { success, statusCode, targetUrl } on success
  • Payload is HMAC-signed and sent with the signature header
  • Non-2xx from target returns success: false, not a server error
  • Network failure returns { success: false, statusCode: 0 }
  • 403 if webhook belongs to another user
  • 404 if webhook does not exist
  • 401 for unauthenticated requests

Sends a signed test ping to a registered webhook URL so users can
verify their endpoint is reachable. Returns success/statusCode/targetUrl.
Non-2xx responses and network errors are caught and returned as
success: false rather than propagating a server error.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

@kehindefaith26 is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@kehindefaith26 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[routes-b] POST /api/routes-b/webhooks/[id]/ping — send a test ping to a webhook

1 participant