Node.js is a JavaScript runtime that allows you to quickly build and deploy web applications. We will be using Node.js to deploy a simple application that listens on a local port for POST requests (our webhook payloads), and then writes those payloads to a textfile on disk.
Before you begin, ensure you have installed Node.js version 8.x 👈
Once installed, you can confirm the version by typing node -v
in your command prompt.
Once you have downloaded this repository, you will want to copy the server.js
into your main folder.
All communication between Portal and your webhook receiver must be done over HTTPS. You will need to add a valid certificate to your application's folder.
Then update the following line in the server.js
file:
const options = {
pfx: fs.readFileSync('your_certificate.pfx'),
passphrase: 'certificate password'
};
Go to your command prompt and launch the application:
cd <application's path>
node server.js
The application will be running on port 8000. You can now use this URL as your payload URL parameter. Note: If the server refuses to start with an error Cannot find module node-fqdn
, from the command window, install the required module and try to start the server again:
npm install node-fqdn
Any payloads received will be written to the webhookPayloads.txt
file in c:\temp
as well as the console running the server.