Webhooks
Receive real-time notifications from external services via webhooks.
Creating a Webhook Endpoint
Create an API route in your project to handle incoming webhooks:
// api/webhooks/stripe.ts
export async function POST(req: Request) {
const body = await req.json();
// Handle the webhook event
return new Response('OK', { status: 200 });
}
Common Webhook Sources
- GitHub: Push events, pull requests, issues
- Stripe: Payment events, subscription updates
- Slack: Messages, slash commands
- Zapier: Custom automation triggers
Webhook Security
Always verify webhook signatures to ensure requests are legitimate. Check the documentation of the service you're integrating with.