App Webhook Validating (V1) Request Problems

Hi all,

I want to validate a webhook request from apublic app I created. I followed this documentation for the v1 validating. Using the data from the example, I receive the same hash as in the docu. However, creating the hash in my function that receives the request, I get a totally different hash. I wonder if I combine the string to hash incorrectly but cannot find any more details on that. If anyone could point out my mistake, I would be very grateful!
I use the following code:

const serviceBusTopicTrigger: AzureFunction = async function (context: Context, hubspotEvent: HttpRequest): Promise<void> {
 const clientSecret = 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy';
 const body = JSON.stringify(hubspotEvent.body);

 const strToHash = clientSecret + body;

 const hash1 = crypto.createHash('sha256').update(strToHash).digest('hex');

};

Thanks a lot!

Hi, @FGamer :waving_hand: Thank you for including your code example in your post. It’s always helpful to see what you’re working with.

I don’t know the answer to this one, but some of our community members might — hey @Teun @Anton @BarryGrennan do you know if the use of

const body = JSON.stringify(hubspotEvent.body);

might be the issue? Is this changing order of the keys in the JSON payload? Giving a different string, and therefore a different hash? Should they try accessing the raw body payload directly? Other thoughts?

Thank you for taking a look! — Jaycee

Hi Jaycee,

without having changed anything, the code now works. As I was also in contact with the hubspot customer service, who escalated the problem to the Hubspot developer team, I suspect they actually fixed this. Nevertheless, thanks for your reply!

Hey hey, @FGamer :waving_hand: Thank you very much for taking the time to follow up. I’m glad to hear this is now resolved.

Have a fantastic week! — Jaycee