Skip to content

sevalla-templates/webhook-discord-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sevalla to Discord Webhook Example

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.

Prerequisites

  • 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.

Deploy to Sevalla

  1. Push this repository to GitHub
  2. In the Sevalla Dashboard, create a new Application
  3. Select your repository
  4. Deploy. Sevalla will build it automatically using Nixpacks
  5. Add the required environment variables under Settings → Environment Variables:
    SEVALLA_WEBHOOK_SECRET=<your webhook secret>
    DISCORD_WEBHOOK_URL=<your Discord webhook URL>
    After deployment, your webhook endpoint will be:
    https://your-app.sevalla.app/webhook
    Use this URL when configuring your Sevalla webhook.

Local Development

Install dependencies:

npm install

Create 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 start

Your webhook endpoint will be available at http://localhost:3000/webhook

Extending

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.

Adding More Event Types

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
}

About

Example to send Discord messages using Webhooks on Sevalla https://sevalla.com/

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors