You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -373,6 +381,47 @@ If you are using Environment Variables as an example you won't be able to specif
373
381
> If you have a string that should not be turned into any other type, then you will need to escape all Type Denotations, `[]` or `{}` (also `-`) with a `\` **Backslash** (or Double Backslash).
374
382
> An **Odd** number of **Backslashes** **escape** the character in front of them and an **Even** number leave the character **as-is**.
375
383
384
+
### Templating
385
+
386
+
Secured Signal API uses Golang's [Standard Templating Library](https://pkg.go.dev/text/template).
387
+
This means that any valid Go template string will also work in Secured Signal API.
388
+
389
+
Go's templating library is used in the following features:
390
+
391
+
- [Message Templates](#message-templates)
392
+
- [Placeholders](#placeholders)
393
+
394
+
This makes advanced [Message Templates](#message-templates) like this one possible:
395
+
396
+
```yaml
397
+
settings:
398
+
messageTemplate: |
399
+
{{- $greeting := "Hello" -}}
400
+
{{ $greeting }}, {{ @name }}!
401
+
{{ if @age -}}
402
+
You are {{ @age }} years old.
403
+
{{- else -}}
404
+
Age unknown.
405
+
{{- end }}
406
+
Your friends:
407
+
{{- range @friends }}
408
+
- {{ . }}
409
+
{{- else }}
410
+
You have no friends.
411
+
{{- end }}
412
+
Profile details:
413
+
{{- range $key, $value := @profile }}
414
+
- {{ $key }}: {{ $value }}
415
+
{{- end }}
416
+
{{ define "footer" -}}
417
+
This is the footer for {{ @name }}.
418
+
{{- end }}
419
+
{{ template "footer" . -}}
420
+
------------------------------------
421
+
Content-Type: {{ #Content_Type }}
422
+
Redacted Auth Header: {{ #Authorization }}
423
+
```
424
+
376
425
### API Token(s)
377
426
378
427
During Authentication Secured Signal API will try to match the given Token against the list of Tokens inside of these Variables.
@@ -454,7 +503,8 @@ settings:
454
503
Sent with Secured Signal API.
455
504
```
456
505
457
-
Use `{{@data.key}}` to reference Body Keys and `{{.KEY}}` for Variables.
506
+
Message Templates support [Standard Golang Templating](#templating).
507
+
Use `@data.key` to reference Body Keys, `#Content_Type` for Headers and `.KEY` for Variables.
0 commit comments