This example receives webhook events from Sevalla (such as APP_DEPLOY or STATIC_SITE_UPDATE) and sends a notification to Discord using a Discord Webhook URL.
- Discord Webhook URL: Follow these instructions to create a Discord webhook.
- Sevalla Webhook: You need to create a webhook in Sevalla. While setting up, you can temporarily use a dummy webhook URL until this app is deployed, so you can obtain the webhook secret. Signature verification can be commented out during the initial setup if needed.
- Push this repository to GitHub
- In the Sevalla Dashboard, create a new Application
- Select your repository
- Deploy. Sevalla will build it automatically using Nixpacks
- Add the required environment variables under Settings → Environment Variables:
After deployment, your webhook endpoint will be:
SEVALLA_WEBHOOK_SECRET=<your webhook secret> DISCORD_WEBHOOK_URL=<your Discord webhook URL>
Use this URL when configuring your Sevalla webhook.https://your-app.sevalla.app/webhook
Install dependencies:
npm installCreate a .env file and update it with your values:
SEVALLA_WEBHOOK_SECRET=your-webhook-secret
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN
Start the development server:
npm startYour webhook endpoint will be available at http://localhost:3000/webhook
Feel free to extend this example to support additional Sevalla webhook events or integrate with other services such as Slack, Telegram, or your own internal APIs.
To handle additional webhook events, simply add new cases to the switch statement in handleEvent():
switch (event.type) {
case "APP_DEPLOY":
await handleAppDeploy(event.data);
break;
case "STATIC_SITE_UPDATE":
await handleStaticSiteUpdate(event.data);
break;
case "DATABASE_CREATE": // Add new event types
await handleDatabaseCreate(event.data);
break;
// ... more cases
}