Skip to main content
A transform changes the body before hooksnode sends it. Write it as a Go text/template. The event body, decoded from JSON, is ..

Examples

Pick fields from a Paystack charge

Write valid JSON

The template prints text. It does not make JSON for you. Use these patterns:

What you can use

  • Field access: {{.data.reference}}
  • Conditions: {{if}} … {{else}} … {{end}}
  • Loops: {{range .items}} … {{end}}
  • Go’s built-in functions, such as printf, len, index, eq, and, or, not
There are no extra functions. For example, there is no toJson.

Limits

For safety, hooksnode also refuses a range over a number, a template that calls itself, and printf widths of 4 digits or more.

When a transform fails

If the transform fails, hooksnode sends the original body and records a warning on the delivery. Check the warning in the inspector.
Use the Test panel in the destination editor to run the transform on a sample body before you save.