This project is a Node.js application that listens for incoming webhook requests and plays a corresponding .wav sound file when a webhook is received. It is designed to be a simple and customizable alert system that can be integrated with various services that support webhooks, made it for my own personal use with .
- Listens for webhook requests on multiple endpoints (
/webhook,/webhook1,/webhook2, etc.). - Plays a specific
.wavfile for each webhook endpoint. - Logs incoming webhook data and playback status.
- Easy to set up and extend.
- Node.js installed on your system.
- NPM (Node Package Manager) installed.
.wavsound files placed in the project directory (e.g.,success1.wav,error1.wav, etc.).
Clone this repository to your local machine:
git clone https://github.com/PhillMckinnon/Play-sound-on-webhook-alert
cd Play-sound-on-webhook-alertInstall the required Node.js dependencies:
npm installPlace your .wav sound files in the project directory. Ensure the filenames match the paths specified in the code (e.g., alert.wav, alert1.wav, etc.).
Start the application using Node.js:
node index.jsThe application will start listening on port 3000. You can test it by sending a POST request to http://localhost:3000/webhook (or any of the other endpoints).
For instructions on setting up the application as a Windows service, see the Windows Setup Guide.
For instructions on setting up the application to run automatically on boot using cron, see the Linux Setup Guide.
Once the application is running, you can send POST requests to the following endpoints to trigger sound alerts:
/webhook→ Playssuccess.wav/error.wav/webhook1→ Playssuccess1.wav/error1.wav/webhook2→ Playssuccess2.wav/error2.wav/webhook3→ Playssuccess3.wav/error3.wav/webhook4→ Playssuccess4.wav/error4.wav
My custom body for Uptime Kuma:

CUSTOM BODY
-----------
{
"heartbeat": {
"status": "{{ heartbeatJSON.status }}",
"msg": "{{ heartbeatJSON.msg }}",
"time": "{{ heartbeatJSON.time }}"
},
"monitor": {
"name": "{{ monitorJSON.name }}",
"url": "{{ monitorJSON.url }}"
},
"msg": "{{ msg }}"
}
ADDITIONAL HEADERS
------------------
{
"Content-Type": "application/json"
}- Add more webhook endpoints by duplicating the existing route handlers and updating the
.wavfile paths. - Modify the port number in the
index.jsfile if needed. - Replace the
.wavfiles with your own sound files.
- Ensure the
.wavfiles are in the correct directory and have the correct filenames. - Check the console logs for any errors related to file paths or playback issues.
- Make sure the application has the necessary permissions to access the sound files.
This project is open-source and available under the MIT License.
Enjoy using the Webhook Sound Alert System! If you have any questions or issues, feel free to open an issue on GitHub.
For any questions or feedback, feel free to reach out to:
Email: phillipmckinnonwork@proton.me
GitHub: @PhillMckinnon