Formatting
Templates are powerful. Use them wisely to transform your webhook data exactly as needed.
Introduction
Template Functions
Template String
formatting:
templateString: |
{{- with $data := fromJSON .Payload -}}
{{- $timestamp := $data.created_at | toDate "2006-01-02T15:04:05Z07:00" | unixEpoch -}}
{
"id": "{{ $data.id }}",
"created": "{{ $timestamp }}",
"reference": "{{ $data.id }}-{{ $timestamp }}"
}
{{- end -}}Template Files
Best Practices
Performance Optimization
Parse Once, use multiple times
Avoid Unnecessary Operations
Avoid String building
Common Issues and Solutions
Issue: Template Syntax Errors
Issue: JSON Escaping
Issue: Nil Pointer
Last updated