The goal
I want to save PagerDuty webhook data to file.
My setup
I followed the Webhook API tutorial Postman Webhooks | Postman Level Up
And it works
I wanted to have my webhook payload written to the file, so I followed Write Responses To File example
And it works in separation.
Then I combined both and wanted the monitor to call my http://localhost:3000/write
, but found it’s impossible due to Postman Monitors Test Failed.
So I wanted to outsmart the system, and instead of calling http://localhost:3000/write
directly, I’m calling https://postman-echo.com/post
(which is publically accessible), and I wrote a test to make the request to my localhost.
const postRequest = {
url: 'http://localhost:3000/write',
method: 'POST',
header: {
'Content-Type': 'application/json'
},
body: {
"uniqueIdentifier": true,
"requestName": "pagerduty-listaner",
"responseData": webhookData
}
};
// Sending request
console.log("Sending request", postRequest)
pm.sendRequest(postRequest, (err, res) => {
console.log(err ? err : res.json())
})
As you can guess, it did not work, and I’m receiving
Error: NETERR: getaddrinfo ENOTFOUND localhost
Any suggestions?
I’ll be trying AWS Gateway + Lambda + S3 tomorrow if no luck with Postman webhook. However, it’s a pretty heavy setup for a simple task I have