What are tokens?
Back to HelpTokens are placeholders in checklist templates. When a template is instantiated, these tokens are expanded in some way. For example, the %date
token is replaced by the current date.
Tokens are brief identifiers prefixed with a %
, and can be present anywhere in a checklist, both titles and descriptions.
Here is a full list of all available tokens:
Token | Description |
---|---|
%date |
The current date in the "Jan 2, 2006" format |
%time |
The current time in the "3:04pm" format |
%D |
Day of the month |
%MMM |
Month in the "January" format |
%MM |
Month in the "Jan" format |
%M |
Month in the "01" format |
%Y |
Year |
As always, let us know if you see a use for a token that isn't on this list.
Webhook Tokens
You can use custom tokens when a template is instantiated via webhook. checklists.fyi looks at the (JSON-encoded) POST
body of the incoming webhook request and matches them against tokens in the checklist template being instantiated.
Here's the basic matching rule: a parameter hello
matches against the token %webhook.hello
. Non-matching parameters are ignored.
POST
requests in response to various triggers.
For example, here's a template with a few webhook tokens:
When I instantiate that template with the following POST
request:
curl -X POST https://api.checklists.fyi/api/checklists/public/a583d2ba-40c9-11ed-9e9e-5a39dbdb907d/instantiate
-H 'Content-Type: application/json'
-d '{"weather":"cold", "weathermsg": "bundle up", "breakfast": "pancake", "temperature": "18"}'
Here's the resulting checklist. Note that the temperature
parameter was ignored, and that the other three parameters were inserted into the checklist.
Basic Token Expansion
As an example, here's a template with the %M
, %Y
, %MM
, %time
, and %date
tokens present.
When this template is instantiated, all tokens are replaced by the values they represent. This example checklist was instantiated on Sep 26, 2022.