Variables
Esta página aún no está disponible en tu idioma.
Variables in the Processor allow you to adjust configuration options depending on the submitted data. For example, you can set the user’s email address as the recipient of the email notification.
Available Variables
- Form Data: To use a value of a submitted field, use variables in the format
{$.data.field_name}
. For example, for the field with the nameemail
, use the variable{$.data.email}
. - Context: Additional information about the user is available under
{$.context.variable}
. For example, to get the user’s IP address, use{$.context.ip_address}
.{$.context.country}
- The 2-letter ISO code of the country.{$.context.ip_address}
- The user’s IP address.{$.context.locale}
- The user’s locale (language) as a 2-letter ISO code.{$.context.mobile}
- Whether the user uses a mobile device (true
orfalse
).{$.context.referrer}
- The HTTP Referer header.{$.context.timezone}
- The user’s timezone.{$.context.user_agent}
- The user’s UserAgent (browser identifier).
- Other:
{$.account_id}
- The ID of the account the form belongs to.{$.form_id}
- The ID of the form.{$.response_id}
- The ID of the response (only set when using the Store in Database processor).
Formatters
To output a properly formatted values, append a pipe (|
) followed by the name of the formatter. Extra arguments can be added after the formater separated by a space.
Variables support the following formatters:
bytes decimals?
- Format bytes to a human-readable format (e.g., 10MB).date timezone? locale?
- Format dates, accepts two optional arguments:timezone
andlocale
.datetime timezone? locale?
- Format dates with times, accepts two optional arguments:timezone
andlocale
.header
- Special formatter for sanitizing HTTP headers.number locale?
- Format numbers, accepts an optional argument:locale
.price currency locale?
- Format prices, expects an additional argument:currency
and an optional argument:locale
.trim
- Trims strings (removes whitespace from the beginning and end).
Usage with extra arguments:
Examples
Sending an Email to the End-User
Let’s assume we have a simple contact form with fields Name (name
) and Email (email
), and we want to send a “thank you” email to the user who submitted the form.
- Add a Send to Email processor.
- In the Recipient field, add
{$.data.email}
:
- In the Email body field, use
{$.data.name}
to refer to the user’s name:
Add User’s IP Address and Referrer to HTTP Headers
When processing form submissions with webhooks (HTTP endpoints), you can add extra information to the HTTP headers. This example adds the user’s IP address:
- Add a Send to HTTP processor.
- In the Headers field, add the following lines:
Notice the |header
formatter at the end of the variable. This special formatter sanitizes the string for use as an HTTP header, and it is recommended to use it in this case to prevent user input from modifying headers.