Which TWIG functions and filters does Aivie support?

With TWIG, you can dynamically build content in Aivie themes, format values, perform calculations, and use conditions. TWIG is primarily used in template files for emails, landing pages, forms, and system messages.

How does a TWIG filter work?

A filter is appended to a value with a vertical bar:

{{ value|filter }}

For example:

{{ firstname|default('Guten Tag') }}
{{ title|upper }}

Multiple filters can be combined:

{{ title|trim|upper }}

Edit text

The following filters are available for text, among others:

FilterUsage
upperConvert text to uppercase
lowerConvert text to lowercase
titleStart words with uppercase letters
capitalizeCapitalize the first letter
trimRemove spaces at the beginning and end
replaceReplace text
striptagsRemove HTML tags
nl2brConvert line breaks to HTML
lengthDetermine the number of characters or elements
defaultUse a default value if no value is present

Example:

{{ company|default('deinem Unternehmen')|trim }}

Format numbers and perform calculations

Twig supports the standard arithmetic operators:

{{ a + b }}
{{ a - b }}
{{ a * b }}
{{ a / b }}
{{ a // b }}
{{ a % b }}
{{ a ** b }}

Additionally, the following filters and functions are helpful:

Filter or functionUsage
intConvert a value to an integer
absDetermine the absolute value
roundRound a number
number_formatFormat a number for output
min()Determine the smallest value
max()Determine the largest value

Example with Swiss number format:

{{ (price|int * quantity|int)|number_format(2, '.', "'") }}

You can round a number like this:

{{ value|round(2) }}
{{ value|round(0, 'ceil') }}
{{ value|round(0, 'floor') }}

Use date values

With date and date_modify, you can format or modify date values:

{{ "now"|date("d.m.Y") }}
{{ dateValue|date("d.m.Y") }}
{{ dateValue|date_modify("+30 days")|date("d.m.Y") }}

Process lists and arrays

The following filters are available for lists, among others:

FilterUsage
firstOutput first element
lastOutput last element
joinJoin elements into text
splitSplit text into elements
keysOutput keys of an array
mergeMerge lists or arrays
sliceUse a slice
sortSort elements
reverseReverse order
batchSplit elements into groups

Example:

{{ tags|join(', ') }}

Use conditions and loops

With conditions, you can display content depending on a value:

{% if points|int >= 100 %}
    Du hast mindestens 100 Punkte erreicht.
{% else %}
    Dir fehlen noch einige Punkte.
{% endif %}

You can output lists with a loop:

{% for item in items %}
    {{ item }}
{% endfor %}

You can also safely calculate a sum with a loop:

{% set total = 0 %}

{% for value in values %}
    {% set total = total + (value|int) %}
{% endfor %}

{{ total|number_format(2, '.', "'") }}

Some functions are blocked for security reasons

Some filters can accept executable functions as arguments. Aivie blocks them to prevent unauthorized code from being executed. For example:

  • map
  • filter
  • reduce

Functions that could access system configuration, database, files, or internal PHP functions are also blocked.

If you need a specific calculation or data transformation that cannot be implemented with the available options, contact us. We will then check whether a secure, clearly limited filter can be added for this purpose.

Important: Not every text field in the Aivie editor processes TWIG. For normal personalization of emails, you continue to use the available Aivie or Mautic tokens.

In short

Aivie supports the standard TWIG functions for text, numbers, dates, lists, conditions, and loops. Dangerous functions and filters with freely executable callbacks are blocked in uploaded themes for security reasons.

You can find more information on the TWIG website.

How can I connect Aivie with Gemini?

You can connect Aivie directly with Google Gemini via the MCP standard (Model Context Protocol). This allows Gemini to securely access your contacts, campaigns, emails, and reports in Aivie and support you with marketing, sales, and customer communication.

Requirements

To connect, you will need:

  • An Aivie installation with the MCP plugin enabled
  • A user account in Aivie
  • A Google account with access to Gemini and support for MCP
  • API credentials (OAuth) from your Aivie installation

If you don’t have API credentials yet, your administrator can create them under Settings → API Credentials.

Prepare Gemini

Open Gemini and add a new MCP connector.

As the connection, enter the MCP endpoint of your Aivie installation. Then select OAuth 2 as authentication and enter the client ID and client secret from your API credentials.

Then also enter the callback displayed by Gemini in the API credentials of your Aivie installation.

Connect with Aivie

After configuration, click Connect and log in with your normal Aivie username and password.

Once the login is successfully completed, all released MCP tools are available to Gemini.

What can Gemini do with Aivie?

After the connection, Gemini can, for example:

  • Search for contacts and companies
  • Prepare meetings
  • Create or optimize marketing emails
  • Analyze campaigns
  • Evaluate reports
  • Search segments
  • Update content directly in Aivie (depending on your permissions)

Which functions are available depends on the activated MCP tools as well as your user rights in Aivie.

Privacy

Aivie was developed so that only the information necessary for the respective request is transmitted to Gemini.

Particularly sensitive personal data such as email addresses, last names, or company names are pseudonymized by default. Gemini therefore works with anonymized data without unnecessary personal information being transmitted.

You control which data Gemini may additionally use via the permissions of the MCP plugin and the user rights in Aivie. Write actions can also be released separately, so that Gemini asks first before making changes.

This way, Aivie combines the possibilities of modern AI with privacy-friendly handling of your customer data.

What is MCP?

MCP (Model Context Protocol) is an open standard that allows AI assistants like Gemini to communicate securely with external applications.

Instead of permanently transferring customer data to an AI, Gemini requests the required information directly via the Aivie MCP plugin as needed. You decide at any time which functions and data are released.

Summary

With the Gemini integration, you can use Aivie directly from Google Gemini. This way, you can research contacts, analyze campaigns, create marketing emails, or prepare meetings without having to switch between different applications.

Why are multiple images displayed under each other or too wide on mobile devices?

I’ve placed multiple images (e.g., 3 brand or product logos) side by side in an email.
The layout is correct on the desktop, but on the smartphone, the images are displayed one below the other, or the columns are very wide, even though the images themselves are small. What’s the reason for this – and how can it be controlled? It’s important to understand the challenges associated with multiple images on mobile.

Continue reading “Why are multiple images displayed under each other or too wide on mobile devices?”

How can I connect Aivie to the ERP Bexio?

With the Aivie Bexio Plugin, you can connect your Aivie CRM directly to Bexio and automatically synchronize relevant customer and contact data. This reduces manual effort, avoids duplicate data maintenance, and ensures that marketing and administration always work with current data. Since both Aivie and Bexio are Swiss solutions, your data remains completely in Switzerland and is subject to Swiss data protection.

Advantages and Features of the Aivie Bexio Plugins

  • Automatic data synchronization
    Transfer contacts and companies from Aivie directly to Bexio – structured and consistent.
  • Single Source of Truth
    Marketing and ERP data remain synchronized, without exports or manual corrections.
  • Time savings and fewer errors
    No more CSV imports or copy-pasting between CRM and ERP.
  • Seamless integration into marketing automation
    Bexio data can be used in Aivie for segments, campaigns, and personalization.
  • Swiss solution
    Ideal for Swiss SMEs that work with Bexio and want to automate their marketing professionally.

You can find more details on the product page:
https://aivie.ch/product/mautic-bexio-plugin/

Step-by-step: Connect Aivie with Bexio

  1. In your Aivie, go to Plugins.
  2. Activate the Aivie Bexio Plugin.
  3. Copy the displayed Callback / Redirect URL.
  4. Create a new app at Bexio under:
    https://developer.bexio.com/
  5. Use the following values:
    • Name: Aivie Bexio
    • Website: https://aivie.ch/
    • Description: Synchronize data from the Aivie CRM to Bexio
    • Redirect URL: Paste the previously copied Redirect URL from the Aivie Bexio Plugin
  6. Save the Bexio App.
  7. Then open the App-Details in Bexio.
  8. Copy the Client ID and the Client Secret.
  9. Paste both values into the settings of the Aivie Bexio plugin.
  10. Click on “Authorize App” to allow Aivie to access your Bexio data.

After successful authorization, the connection is active and data synchronization can be used.

Why is my tracking not working during testing?

Important to know when testing

If you are logged in to Aivie, tracking is disabled for this browser.

This means you have to copy the email link into a new browser to test it, test it on your smartphone or log out of Aivie after submitting the form.