NodeJS/Express webhook to trigger something
Boilerplate that accepts a POST request at /hook/{.env/WEBHOOK_PATH}
and parrots back the response
Package | Version | URL |
---|---|---|
NodeJS | v16.x | https://nodejs.org |
express | ^4.17.1 | https://www.npmjs.com/package/express |
body-parser | ^1.19.0 | https://www.npmjs.com/package/body-parser |
dotenv | ^10.0.0 | https://www.npmjs.com/package/dotenv |
- Clone the repo
- Run
yarn
to install node modules - Copy
.env.example
to.env
and set variables - Set
TESTING
tofalse
to execute script - Ensure shell script has execute permissions
yarn start
- Browse to
localhost:PORT/hook/WEBHOOK_PATH
- Setup PM2
- Run
pm2 start npm --name express-webhook -- run start
- Serve the port through the firewall or use Nginx to proxy