opennodedev / opennode-node

Node.js library for the OpenNode API. https://opennode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webhook body undefined

hellseyfer opened this issue · comments

Webhook body is undefined.
I tried webhook tool in the web both production and dev and none of them returns a body in the request.

`app.post('/webhook/charge', async (req, res) => {
const charge = req.body;
const isValid = await opennode.signatureIsValid(charge); //fails because req.body is undefined

if (isValid) {
//Handle event
console.log('Webhook signature is valid');
}
console.log('Webhook signature is invalid');
return res.sendStatus(200);
});`

my bad, I just needed body parser

const bodyParser = require('body-parser');

// Middleware
app.use(bodyParser.urlencoded({ extended: false }));