Aller au contenu

Variables

Ce contenu n’est pas encore disponible dans votre langue.

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 name email, 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 or false).
    • {$.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.

{$.data.name|trim}

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 and locale.
  • datetime timezone? locale? - Format dates with times, accepts two optional arguments: timezone and locale.
  • 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:

Date: {$.data.date|date Europe/London en-GB}
Date and time: {$.data.date|datetime $.context.timezone $.context.locale}
Price: {$.data.price|price EUR $.context.locale}

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.

  1. Add a Send to Email processor.
  2. In the Recipient field, add {$.data.email}:
{$.data.email}, info@my-website.com
  1. In the Email body field, use {$.data.name} to refer to the user’s name:
Hello {$.data.name},
Thank you for your message. We'll be in touch soon.
Best Regards,
Website Team

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:

  1. Add a Send to HTTP processor.
  2. In the Headers field, add the following lines:
x-user-ip-address: {$.context.ip_address|header}
x-user-referrer: {$.context.referrer|header}

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.