# Webhook request validation in kotlin

**URL:** <https://community.hubspot.com/t/webhook-request-validation-in-kotlin/116647>\
**Category:** APIs & Integrations\
**Tags:** webhooks\
**Created:** [September 19, 2024, 8:03am UTC](https://community.hubspot.com/t/webhook-request-validation-in-kotlin/116647 "2024-09-19T08:03:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksudheer8739](https://avatars.discourse-cdn.com/v4/letter/k/ecd19e/32.png) [@ksudheer8739](https://community.hubspot.com/u/ksudheer8739)\
**Post date:** [September 19, 2024, 8:03am UTC](https://community.hubspot.com/t/webhook-request-validation-in-kotlin/116647/1 "2024-09-19T08:03:30Z")

</div>

can some one help me to implement signature validation for hubspot webhooks api. I created a webhook for a private app to receive property change event, and i have a new service which will accept the webhook events. I am trying to implement the validation as below

I am getting different signatures.  
Request body i am using: Raw Request Body: [{“eventId”:1533917858,“subscriptionId”:2811863,“portalId”:20114015,“appId”:3388772,“occurredAt”:1726718100167,“subscriptionType”:“object.propertyChange”,“attemptNumber”:0,“objectId”:22403328019,“objectTypeId”:“0-3”,“propertyName”:“dealstage”,“propertyValue”:“17480144”,“changeSource”:“CRM\_UI”,“sourceId”:“userId:65741093”,“isSensitive”:false}]

Service is in development stage, so i copied the event body from aws logs, and using it in my service

---

<div class="post-metadata">

**Author:** ![ksudheer8739](https://avatars.discourse-cdn.com/v4/letter/k/ecd19e/32.png) [@ksudheer8739](https://community.hubspot.com/u/ksudheer8739)\
**Post date:** [September 24, 2024, 4:52am UTC](https://community.hubspot.com/t/webhook-request-validation-in-kotlin/116647/2 "2024-09-24T04:52:34Z")

</div>

here is what i am doing

`val sourceString = clientSecret + requestBody`

`val digest = MessageDigest.getInstance("SHA-256")`

`val dataBytes = digest.digest(sourceString.toByteArray(Charsets.UTF_8))`

`dataBytes.joinToString("") { "%02x".format(it) } ``// the hex string i am getting is not the same i got from the webhook event`

Note: I am using the latest object strucuture.
