messagebird-nodejs
messagebird-nodejs copied to clipboard
Webhook signature problems with Nextjs
Hey guys, I can't seem to get the webhook verification working.
The docs seem to be out of date and the variables as I needed to manually construct the headers, currently getting "Signatures not match."
const signature = headers().get("Messagebird-Signature");
const timestamp = headers().get("Messagebird-Request-Timestamp");
const body = await req.text();
const result = validate(
{
headers: {
"messagebird-request-timestamp": timestamp,
"messagebird-signature": signature,
},
body,
query: {
statusDatetime: "2019-01-11T09:17:11+00:00",
},
url: `https://${process.env.NGROK_DEVELOPER_URL || process.env.NEXT_PUBLIC_WEB_URL}/api/webhooks/bird`,
},
process.env.BIRD_SHARED_SECRET || ""
)