user-1
(User 1)
1
This topic was automatically generated from Slack. You can find the original thread here.
The webhooks from DBT Cloud provide a way to validate the origin of the requests, but it requires the raw request body.
What would be the best way to do that in Pipedream?
user-1
(User 1)
2
How can I access the raw request body from an HTTP trigger?
user-1
(User 1)
3
I’ve tried re-encoding the body in JSON, but it doesn’t seem to create the exact same string as the original. 
user-1
(User 1)
4
Here is some python code: signature = hmac.new(app_secret, request_body, hashlib.sha256).hexdigest()
What would be the node.js equivalent?
user-1
(User 1)
5
Are you using the job-run-completed
source in Pipedream?
Or is it a custom HTTP webhook?
user-1
(User 1)
7
Is the HTTP source emitting body only or the full request?
user-1
(User 1)
8
full request (because I need to check the headers for the auth)
user-1
(User 1)
9
Ah then the rawBody
should be emitted also, are you able to see it?
user-1
(User 1)
11
Haha happens with all of us
user-1
(User 1)
12
This is all I seem to get 

user-1
(User 1)
13
rawBody
is undefined (unless I’m doing it wrong)

user-1
(User 1)
14
Strange, is dbt sending the rawBody
? Pipedream doesn’t remove it, many sources use it for validating the webhooks
user-1
(User 1)
16
I think I should be good now! 
mroy
(Mroy)
18
Here’s the node.js code to authenticate the requests:
import crypto from "crypto";
const sign = crypto
.createHmac('sha256', <DBT_WEBHOOK_KEY>)
.update(<RAW_BODY_FROM_DBT_WEBHOOK>)
.digest('hex');