Has anyone sucessfully validated an incoming request where the body included emoji text? I’m following the v3 of this guide (Webhooks | Validating Requests - HubSpot docs) and have not had a problem until now (multiple months in production)
Thanks
Has anyone sucessfully validated an incoming request where the body included emoji text? I’m following the v3 of this guide (Webhooks | Validating Requests - HubSpot docs) and have not had a problem until now (multiple months in production)
Thanks
Hi, @EFiori
I am with you, the documentation doesn’t give us much to work with for this specific issue. Do you have access to support? If so, it might be worth filing a support ticket to get clarity.
Hey, @JBeatty @louischausse, can you add anything here?
Thank you! — Jaycee
I have submitted a support ticket, hopefully they can assist.
Thanks
For those using expressjs and bodyParser.json() you may need to make the raw body available as a buffer to your validation code. I was able to do this with:
app.use(bodyParser.json({
verify: function(req, res, buf, encoding) {
(req as any).rawBuffer = buf;
}
}));
The in my middleware I created the computed signature as described in the docs, passing that buffer into the update method as requestBody:
const computedSignature = crypto.createHmac('sha256', CLIENT_SECRET)
.update("POST" + WEBHOOK_URI)
.update(requestBody)
.update(timestamp)
.digest("base64");
This computed signature now matches the provided signature (that’s in the header) for webhooks with or without emojis in the request body.
Hey, @EFiori Thank you very much for coming back and sharing your solution! — Jaycee