Transformations
ProxyHook's Transformations feature lets you write custom functions to implement specific use-cases on your event data, like:
- Filtering or sampling events
- Cleaning or aggregating data
- Data masking or removing sensitive PII to ensure data privacy
- Enriching events by implementing static logic or leveraging an external API
- Using an API to implement specific actions on the events
Getting Started
- Login to your ProxyHook dashboard
- Select your desired destination to apply a transformation to under Destinations
- Click Transformation.
Within this page you'll be able to leverage custom javascript to modify the payload as needed. Depending on the integration you have the ability to edit:
- Header
- Body
- Endpoint
Example - Reducing Payload
Let's take a basic example where you want to simplify the payload that is being sent to your custom webhook. Given that ProxyHook will standardize all incoming requests, a HTTP POST request track event with a small json of
{
"brand": "adidas",
"price": 24
}
Will be converted into
{
"anonymousId": "6681e468-d095-4448-a951-bdc6e191dba9",
"channel": "web",
"context": {
"app": {
"name": "Proxyhook Webhook SDK",
"version": "1.7.0"
},
"os": {},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
},
"event": "webhook",
"messageId": "9080b062-e8d4-4d74-8ced-7d903aaa3871",
"originalTimestamp": "2023-12-29T18:45:58.089Z",
"properties": {
"brand": "adidas",
"price": 24
},
"proxyHookID": "e160ccf4-5939-4509-95e3-450afc32cee5",
"sentAt": "2023-12-29T18:45:58.089Z",
"type": "track"
}
While the additional information is cruical for third party integrations and data standardization, you may want to send this data to another third party without the excess information. As a result, you can apply a tranformation to only send the original properties:
//modify body
function transformBody(body) {
return body.properties;
}
The result payload (which can be seen in the preview section) would be:
{
"brand": "adidas",
"price": 24
}