Transformations
Try a transformation on a webhook a source received, or on a sample, and see what it would send.
Try a transformation
/v1/projects/{project}/transformations/tryRuns a transformation once, the way a delivery would, and returns what it would send. Nothing is saved, and nothing is sent to a destination. Needs the Edit and resend permission.
codestringJavaScript that defines
transform(request), not empty, and at most 64 KB. See Change webhooks before they are sent.eventIdstringAn event to run it on. Without it, it runs on a sample: a
POSTwithcontent-type: application/jsonand the body{"hello":"world"}.
A transformation that fails still answers 200, with the reason in error:
{
"input": {
"method": "POST",
"path": "/",
"query": "",
"headers": { "content-type": "application/json" },
"body": { "reference": "ORD-104233", "amount": 25000 }
},
"output": {
"headers": [{ "name": "x-order-id", "value": "ORD-104233" }],
"body": "{\"orderId\":\"ORD-104233\",\"amountTzs\":25000}",
"bodyEncoding": "text"
},
"error": null,
"logs": ["payment ORD-104233"],
"durationMs": 3
}inputobjectThe
requestthe transformation got.outputobject or nullWhat it would send, before the authentication and signing headers are added:
headers, each{ name, value },body, andbodyEncoding,textorbase64.nullwhen it failed.errorstring or nullWhy it failed, such as a syntax error, a thrown error, a wrong shape, or running out of time or memory.
nullwhen it worked.logsstring[]The lines it wrote with
console.log.durationMsintegerHow long it ran, in milliseconds. A delivery stops it after 100 ms.
An event the project does not have gets 404. When we cannot run the transformation this time, the answer is 503 with the code unavailable; try again.
Last updated