Skip to main content
Webhook transformations let you modify the payload before it’s delivered to your endpoint. This is useful for:
  • Reducing payload size — Remove fields your endpoint does not need
  • Reshaping the schema — Transform the data structure to match what your system expects
  • Filtering data — Remove fields you don’t need
Transformations run server-side before the webhook is sent, so your endpoint receives exactly what you want.

Enabling Transformations

1

Open the Webhooks portal

Navigate to the Webhooks tab in your Cyberdesk dashboard.
2

Select your endpoint

Click on the Endpoints tab and select the endpoint you want to transform.
3

Open Advanced settings

Click on the Advanced sub-tab within the endpoint details.
4

Enable transformations

Toggle Enable Transformation to on.
5

Edit your transformation

Click Edit Transformation next to the toggle to open the transformation editor.
6

Write and test your code

Write your JavaScript transformation function, then use the Test feature to verify it works with sample payloads.

Writing a Transformation

Transformations are JavaScript functions that receive the webhook data and return a modified version. The function must be named handler and receives an object with these properties: The function must return the same object, but may modify its properties as described above. You can also set these additional properties on the returned object:

Example: Remove Output Data

If your endpoint only needs run status and metadata, remove output_data to reduce payload size:

Example: Extract Only What You Need

Keep just the essential fields for your downstream system:

Example: Cancel Webhooks Conditionally

You can cancel delivery for certain events:
Cancelled messages appear as successful dispatches in the logs but are not actually sent to your endpoint.

Example: Add Custom Headers

Add headers for routing or authentication on your end:

Testing Your Transformation

The transformation editor includes a test panel where you can:
  1. Select an event type to get a sample payload
  2. Or paste a custom payload
  3. Run your transformation
  4. See the resulting webhook that would be sent
Always test your transformation before saving to ensure it produces the expected output.

Common Issues

Make sure the Enable Transformation toggle is on. The toggle and edit button are on the same line in the Advanced tab.
Verify you’re returning the modified webhook object from your handler function. If you forget to return, the original payload is sent.
Check the browser console for syntax errors. Common issues:
  • Missing semicolons or brackets
  • Accessing properties on undefined (use optional chaining: webhook.payload.run?.status)
  • Invalid JSON in test payloads
Your transformation might be throwing an error. Wrap risky operations in try/catch:
The default run_complete payload omits run_message_history. If your payloads are still too large, remove other large fields such as output_data or create a minimal payload with only the fields you need.

Learn More

For detailed documentation on writing transformations, including advanced patterns and the complete API reference, see the Svix Transformations documentation.