APIs & Integrations

alvinlzg
Participant

Webhook validation not working for Contact workflow

Hi,

I'm facing issue authenticating webhook triggered by Contact. Deal works fine. Both are using the same App Id, thus same secret key. 

I also tried to just use webhook.site, and Contact could not work.

 

		String hsDeal = "afc300fde1d4937750a02ea683115892ad50b9013dda501ea7f59df7a03b7f6c";
		String dealBody = = "deal_x"; //string is too long to be included
		String sourceStringDeal = "client_secret" + "POST" + "https://webhook.site/4daeacf0-839d-438a-bbdf-e253418cc4e9" + dealBody;
		System.out.println("\n deal sourceString = " + sourceStringDeal);
		System.out.println("\n deal hashed = " + DigestUtils.sha256Hex(sourceStringDeal));	
		System.out.println("\n auth = " + (DigestUtils.sha256Hex(sourceStringDeal).equals(hsDeal)));
		
		String hsContact = "b3fae226fa8d220f4ca5604c94ead6b344388cf0298a94d6c3f979105aa1672d";
		String contactBody = "contact_x"; //string is too long to be included
		String sourceStringContact = "client_secret" + "POST" + "https://webhook.site/4daeacf0-839d-438a-bbdf-e253418cc4e9" + contactBody;
		System.out.println("\n contact sourceString = " + sourceStringContact);
		System.out.println("\n contact hashed = " + DigestUtils.sha256Hex(sourceStringContact));
		System.out.println("\n auth = " + (DigestUtils.sha256Hex(sourceStringContact).equals(hsContact)));

Any help is much appreciated.

 

Thanks.

Alvin

 

0 Upvotes
2 Replies 2
Mike_Eastwood
Key Advisor | Gold Partner
Key Advisor | Gold Partner

Webhook validation not working for Contact workflow

Hi @alvinlzg 

 

I found some special charaters in the Contact fields broke my validation.

 

I asked in the developers Slack channel and the advice was:

 

We recently added a note here https://developers.hubspot.com/docs/faq/v2-request-validation to indicate that all strings should be utf-8 encoded before the SHA-256 hash. That should handle the special characters. Let me know if you run into any issues 

 

Haven't tested it yet... hopefuly it solves your problem and mine.

 

Cheers

Mike

0 Upvotes
alvinlzg
Participant

Webhook validation not working for Contact workflow

Hi @Mike_Eastwood , I've tried with the UTF-8 approach. Not working still. Have raised a support ticket, not sure if they can help.

Actually, what I need to do is to get info from HubSpot, and the sending of the info will be triggered from workflow via webhook. 

If this does not work, I will only have 2 options left - to either use Deal > Association > Contact or, to implement a scheduler to pool data periodically from HubSpot (not the best practice).

 

Thanks.

0 Upvotes