0

I have a nodejs server and I would like to consume the data coming from a webhook service provider. This webhook provider is from weTravel but they are using svix as webhook provider. I have setup my endpoint like this on the svix dashboard and I can see that the webhook trigger works. I want to get the data when a user books for a package and I can see success status that the webhook was sent to my endpoint:

https://jay-api.onrender.com/api/v1/getpayment

But how do I get this data in my nodejs? How do I go about it? Here is what I tried doing in my node.js server:

export const httpWebHookPayment = async(req: Request, res: Response)=>{

console.log(req.body, 'webhost');

 return res.status(200).end()
 }

It is not displaying the data for me. It is just returning empty object and not throwing error. The answer pointed to me for reference and my question are not same. That answer was 8 years ago and I am using this already in my code to parse my code to json:

app.use(express.json());

And I get data from all my API requests that I created in this server. It is the webhook that I can't seem to get the data.

Kindly open my question so that I can get help

kingNodejs
  • 39
  • 1
  • 7

0 Answers0