Skip to main content
Version: Next

Templating

Configure templating settings.

Example:

settings:
message:
templating:
body: true
query: true
path: true

The example config entry above enables templating or rather placeholders in all mediums: in the body, in the query and also in the path:

curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer API_TOKEN" \
-d '{ "number": "{{.NUMBER}}" }' \
'http://sec-signal-api:8880/{{.PATH}}/v1/send?@message={{.MESSAGE}}'

Message Templates

Message Templates are the best way to structure and customize your messages and can be very useful for compatibility between different services.

Configure them by using the message.template attribute in you config.

These support Go templates (see Formatting) and work by templating the message field in the request's body.

Here is an example:

settings:
message:
tempalting:
messageTemplate: |
{{- $greeting := "Hello" -}}
{{ $greeting }}, {{ @name }}!
{{ if @age -}}
You are {{ @age }} years old.
{{- else -}}
Age unknown.
{{- end }}
Your friends:
{{- range @friends }}
- {{ . }}
{{- else }}
You have no friends.
{{- end }}
Profile details:
{{- range $key, $value := @profile }}
- {{ $key }}: {{ $value }}
{{- end }}
{{ define "footer" -}}
This is the footer for {{ @name }}.
{{- end }}
{{ template "footer" . -}}
------------------------------------
Content-Type: {{ #Content_Type }}
note

Supported placeholder types:

. Variables@ Body# Headers