Build
Variables and templates
Email recipients, subjects and messages, chat messages, Set values and Ask AI instructions can all use the answers of a submission. Write a field key in double braces and Formpik fills it in for every submission.
On this page you will learn
- The template syntax, fallbacks and stored values
- How every kind of answer reads
- System values like the form name and the date
- Values made by Set values and Ask AI
- Which settings take templates, and what the webhook sends instead
- The safety rules for auto-replies
Syntax
| Write | You get |
|---|---|
{{key}} | The answer of the field with that key, as people read it. |
{{key | fallback}} | The fallback when the answer is empty or the key is unknown. |
{{key.value}} | The stored value of a choice field, such as 50k_plus, instead of its label. |
{{form.name}} | A system value, listed below. |
{{ai_summary}} | A value made by an earlier Set values or Ask AI step. |
- Keys use letters, numbers, underscores and dots. Spaces inside the braces are fine:
{{ name | there }}works. - A fallback is plain text and cannot contain a closing brace.
- There are no conditions, loops or filters. Use Set values to prepare a value, or If / else to send different messages.
- In any template setting, the variable menu inserts a variable at the cursor, grouped as Fields, Values and Submission.
Examples, rendered
These templates are rendered by the same code the flows use, for a Quote request submission from Ana Ruiz who left the company empty:
| Template | Result |
|---|---|
Hi {{name}} | Hi Ana Ruiz |
Hi {{ name | there }} | Hi Ana Ruiz |
{{budget}} | $25k to $50k |
{{budget.value}} | 25k_50k |
{{company | no company given}} | no company given |
{{service}} for {{company}} | Website for |
{{form.name}} via {{source.domain}} | Quote request via yourcompany.com |
{{submission.date}} | Nov 20, 09:30 UTC |
How answers read
- Choices read as their labels, lists as labels joined with commas.
- Yes or no reads as its button label, and a country as its name.
- Ratings and scales read as "4 of 5" and "9 of 10". Amounts read with their currency after the number, such as "2500 EUR".
- Date and time reads with a space instead of the T. A consent field reads as Yes or No.
- File uploads read as the file names.
- Answers to keys that are not fields of the form read exactly as they were sent.
The Field types page shows every type side by side.
System values
| Variable | Value | Example |
|---|---|---|
{{submission.all_fields}} | All answers | One line per answer, see below |
{{form.name}} | Form name | Quote request |
{{source.name}} | Source name | Marketing site |
{{source.domain}} | Source website | yourcompany.com |
{{submission.date}} | Received at | Nov 20, 09:30 UTC |
{{submission.id}} | Submission ID | sub_7hq2xk |
{{submission.all_fields}} lists every answer as "Label: answer", in the order of the form, followed by keys the form does not know. Empty answers, layout blocks and keys starting with an underscore are left out. For the example submission:
Your name: Ana Ruiz
Email: ana@example.com
What do you need?: Website
Budget: $25k to $50k
Project details: We are relaunching our marketing site in March and need design and build. About 12 pages, with a blog.Test runs in the flow editor have no source, so the source name reads "Test submission" there. Dates are in UTC.
Values from steps
Set values builds new values from answers, such as a greeting or a combined name, and Ask AI saves its answer as a value. Both can be used in every later step by name, such as {{ai_summary}}, and they are listed under Values in the variable menu.
| Set values | Template | Result |
|---|---|---|
| greeting | Hi {{name | there}} | Hi Ana Ruiz |
| deal | {{company | Unknown company}}, {{budget}} | Unknown company, $25k to $50k |
A value only exists after its step ran. Used on a path where the step did not run, it is empty, so give it a fallback.
Where templates work
| Step | Settings that take templates |
|---|---|
| Send email | To, Cc, Reply to, Subject, Message |
| Reply to sender | To, Reply to, Subject, Message |
| Post to Slack, Teams, Discord | Message |
| Set values | Every value |
| Ask AI | Text to read, and the instructions |
| Send webhook | None: the body is fixed JSON, see below |
Route by answer and If / else do not use templates: you pick the field or value from a list.
Worked examples
Email to the team
A Send email step with Reply to {{email}}, behind an Ask AI step that summarizes:
Subject: Quote request: {{name}}, {{budget}}
New quote request from {{name}} ({{email}})
Company: {{company | not given}}
Received {{submission.date}} on {{source.domain}}
{{ai_summary | No summary}}
{{submission.all_fields}}The summary in the result is an example of what AI might write.
Auto-reply to the sender
A Reply to sender step. It uses only short answers, so nothing is left out:
Subject: Thanks, {{name | there}}
Hi {{name | there}},
Thanks for asking about {{service}} with a budget of {{budget}}. We reply within one working day.
Your reference: {{submission.id}}Slack message
*{{name}}* asked for a quote: {{service}}, {{budget}}
{{ai_summary | No summary this time}}Turn on Include every answer to list the answers under the message, so the template can stay short.
Webhook body
Webhooks do not take a template. Every webhook gets the same JSON: the answers as sent under data, and under values the readable answers plus every value from Set values and Ask AI. To send a value of your own, create it with Set values first. The example submission arrives like this:
{
"event": "submission.created",
"submission_id": "sub_7hq2xk",
"form": {
"id": "frm_example",
"name": "Quote request"
},
"source": {
"id": "src_marketing",
"name": "Marketing site",
"domain": "yourcompany.com"
},
"received_at": "2026-11-20T09:30:00.000Z",
"data": {
"name": "Ana Ruiz",
"email": "ana@example.com",
"company": "",
"service": "website",
"budget": "25k_50k",
"details": "We are relaunching our marketing site in March and need design and build. About 12 pages, with a blog."
},
"values": {
"name": "Ana Ruiz",
"email": "ana@example.com",
"company": "",
"service": "Website",
"budget": "$25k to $50k",
"details": "We are relaunching our marketing site in March and need design and build. About 12 pages, with a blog.",
"ai_summary": "Ana Ruiz wants a new 12 page marketing site with a blog, designed and built before a March relaunch. Budget is $25k to $50k."
}
}Formatting and escaping
- Emails are plain text. Formpik also sends an HTML version in which everything is escaped and line breaks are kept, so HTML in a template or an answer shows as text and never as markup.
- Subjects keep to one line: line breaks become spaces.
- Slack messages use Slack formatting, so *bold* and _italic_ work in Slack.
- Discord messages never ping anyone, because mentions are switched off.
- An unknown variable renders as nothing, or its fallback. Go live flags variables that are neither fields of the form nor values from a step.
Auto-replies stay safe
Reply to sender emails go to an address the visitor typed. Without limits, anyone could type someone else's address and their own message and use your form to send it. So in a Reply to sender step:
| Rule | Effect |
|---|---|
| Long free text is left out | Long text, address, website and file answers render empty, and so does {{submission.all_fields}}. |
| Short answers are capped | Every other answer, and every value from Set values and Ask AI, is cut after 80 characters and ends with "...". |
| Unknown keys render empty | Keys the website sent that are not fields of the form are left out. |
| One recipient | Only the first valid address gets the email, with no Cc. |
| 3 emails a day | An address typed into a form gets at most 3 emails a day. Further ones are skipped and the step says so. This also applies to Send email steps whose To uses a variable. |
Common questions
Why is my variable empty?
Can I write HTML in an email?
How do I get the stored value of a dropdown?
.value to the key: {{budget.value}} gives 25k_50k where {{budget}} gives "$25k to $50k".Do fallbacks work with system values and AI values?
{{ai_summary | No summary}}.