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
@@ -220,6 +228,47 @@ If you are using Environment Variables as an example you won't be able to specif
220
228
> 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).
221
229
> An **Odd** number of **Backslashes** **escape** the character in front of them and an **Even** number leave the character **as-is**.
222
230
231
+
### Templating
232
+
233
+
Secured Signal API uses Golang's [Standard Templating Library](https://pkg.go.dev/text/template).
234
+
This means that any valid Go template string will also work in Secured Signal API.
235
+
236
+
Go's templating library is used in the following features:
237
+
238
+
- [Message Templates](#message-templates)
239
+
- [Placeholders](#placeholders)
240
+
241
+
This makes advanced [Message Templates](#message-templates) like this one possible:
242
+
243
+
```yaml
244
+
settings:
245
+
messageTemplate: |
246
+
{{- $greeting := "Hello" -}}
247
+
{{ $greeting }}, {{ @name }}!
248
+
{{ if @age -}}
249
+
You are {{ @age }} years old.
250
+
{{- else -}}
251
+
Age unknown.
252
+
{{- end }}
253
+
Your friends:
254
+
{{- range @friends }}
255
+
- {{ . }}
256
+
{{- else }}
257
+
You have no friends.
258
+
{{- end }}
259
+
Profile details:
260
+
{{- range $key, $value := @profile }}
261
+
- {{ $key }}: {{ $value }}
262
+
{{- end }}
263
+
{{ define "footer" -}}
264
+
This is the footer for {{ @name }}.
265
+
{{- end }}
266
+
{{ template "footer" . -}}
267
+
------------------------------------
268
+
Content-Type: {{ #Content_Type }}
269
+
Redacted Auth Header: {{ #Authorization }}
270
+
```
271
+
223
272
### API Token(s)
224
273
225
274
During Authentication Secured Signal API will try to match the given Token against the list of Tokens inside of these Variables.
@@ -301,7 +350,8 @@ settings:
301
350
Sent with Secured Signal API.
302
351
```
303
352
304
-
Use `{{@data.key}}` to reference Body Keys and `{{.KEY}}` for Variables.
353
+
Message Templates support [Standard Golang Templating](#templating).
354
+
Use `@data.key` to reference Body Keys, `#Content_Type` for Headers and `.KEY` for Variables.
0 commit comments