Skip to main content

I have some troubles with webhooks. For unknown reasons Webhook's verification fail for one particular customer. But not for all the time. Sometimes it succeeds (I'd say it fails 1 out of 10 ).

Do you have any tips on how to debug this issue? I logged the payload and it doesn't look suspicious. Just a regular user.tag.created event.

 

Here is how I verify webhook

```

const verifySignature = ({payload, secret, signature}) => {

const stringified = JSON.stringify(payload);

const calculatedSignature = `sha1=${crypto

.createHmac('sha1', secret)

.update(stringified)

.digest('hex')}`;

if (calculatedSignature !== signature) {

throw badRequest(`Invalid signature provided`);

}

};

export const verifyWebhook = ({clientSecret}) => async ({params, payload}) => {

verifySignature({

payload, //req.body parsed by koa-body

secret: clientSecret,

signature: paramss'x-hub-signature'],

});

return {id: payload.app_id};

};

```

Thanks in advance for any insigths!

I have experienced issues in one of our systems while the other has never had issues (they manage different topics). The issue with the verification is related to the encoding, instead of UTF-8 the payload was validated succesfully if decoded with windows-1252 😲 , also happened with the user.tag.created topic. Could be a problem of out server configuration, I am still trying to figure it out

 


I sent this to the intercom support and they opened the issue in April. Hope it will get fixed some day


Reply