https://github.com/asikur-dev/github-webhook-notifier-server
Automating GitHub Push Notifications to Discord - Streamline your development workflow by automatically sending GitHub push notifications to a Discord channel. This setup uses a Node.js server to process webhook events, extract key details like usernames and commit messages, and deliver customizable alerts with fallback options for robustness.
https://github.com/asikur-dev/github-webhook-notifier-server
asikur discord-push github github-actions push-notifications
Last synced: about 2 months ago
JSON representation
Automating GitHub Push Notifications to Discord - Streamline your development workflow by automatically sending GitHub push notifications to a Discord channel. This setup uses a Node.js server to process webhook events, extract key details like usernames and commit messages, and deliver customizable alerts with fallback options for robustness.
- Host: GitHub
- URL: https://github.com/asikur-dev/github-webhook-notifier-server
- Owner: asikur-dev
- License: other
- Created: 2025-06-11T12:55:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-12T08:27:32.000Z (about 1 year ago)
- Last Synced: 2025-09-18T23:28:47.770Z (9 months ago)
- Topics: asikur, discord-push, github, github-actions, push-notifications
- Language: JavaScript
- Homepage: https://github-webhook-notifier-server.onrender.com/
- Size: 22.5 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# GitHub to Discord Push Notification
An automated system to send GitHub **push event** notifications to a Discord channel using webhooks. Built with **Node.js**, this project listens to GitHub webhook payloads and sends customizable messages to keep your team updated in real-time.
---
## π Features
* **Real-time notifications** for GitHub push events
* **Customizable messages** via query parameters
* **Robust fallbacks** for missing payload data
* **Easy to deploy** on platforms like Render
* **Support for multiple GitHub events** with extensibility
---
## π§ Prerequisites
* Node.js (>= 18.0.0)
* A Discord server with a webhook URL
* Access to a GitHub repository
---
## π¦ Installation
```bash
git clone
cd
npm install
```
---
## βοΈ Configuration
Create a `.env` file in the root:
```env
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-id/your-webhook-token
```
> β οΈ Do **NOT** commit `.env` β add it to `.gitignore`
---
## π₯οΈ Running the Server Locally
```bash
npm start
```
### π’ Render Deployment
* Ensure your server listens to `process.env.PORT || 9000`
* Set `DISCORD_WEBHOOK_URL` in Renderβs environment settings
* Deploy the project to Render
---
## π GitHub Webhook Setup
1. Go to your GitHub repository β **Settings** β **Webhooks** β **Add webhook**
2. **Payload URL**: `https://your-server.onrender.com/github-webhook`
3. **Content Type**: `application/json`
4. **Events to Trigger**: Select `Let me select individual events` and check `Pushes`
5. **Save** the webhook
---
## βοΈ How It Works
### Server Operation
* The server runs on `/github-webhook`
* Extracts commit data: username, repository name, commit message, URL
* Supports optional query string: `?message=` or `?data=` (default: `Asikur (default user)`)
### Discord Notification
* Sends message to `DISCORD_WEBHOOK_URL`
* Format:
```
Someone pushed to Unknown Repository: No commit message (No commit URL) - Custom note: Asikur (default user)
```
### Extending Support
* Add event handlers in `index.js` for other GitHub events (e.g., pull requests, issues, releases)
* Use `payload.action` or `payload` structure to customize the message
---
## π― Benefits
* π‘ **Instant Updates**: Avoid manual status updates
* βοΈ **Efficient Workflow**: Streamlined team communication
* βοΈ **Custom Notes**: Add context with `?message=` or `?data=`
* π **Reliable Defaults**: Handles missing GitHub fields
* π’ **Scalable Integration**: Supports multiple channels or repositories
---
## π Use Cases
* π Push to GitHub β Auto notify on Discord
* π§ Pass custom notes with push using query parameters
* π§βπ» Collaborate better with real-time updates
---
## π§ͺ Troubleshooting
* **404 Error**: Ensure server is running and endpoint URL is correct
* **500 Error**: Check `DISCORD_WEBHOOK_URL` validity
* **No Notification**: Confirm GitHub webhook is active and push event is selected
---
## π§© Customizing Events
Go to **Webhook Settings β Let me select individual events**:
* β
Pushes *(default implemented)*
* π Pull Requests
* π Issues
* π Releases
Update `index.js` to parse and send messages for those events accordingly.
---
## π€ Contributing
Pull requests and issue reports are welcome!
---
## π License
This project is licensed under the **ISC License**.