Using dynamic variables with macros

Edited

Overview

Dynamic variables intelligently adjust to the factors of a conversation and can give a dynamic output that would otherwise require a human to analyze. Use them to branch your macro flows or take actions based on recipient or conversation data. 

This allows you to customize your macros to solve more complex problems in a single click, letting Front do the thinking for your teammates as your macros dynamically evaluate the different pieces of information in your conversations and action on them accordingly.


When to use dynamic variables with macros

Macros are a powerful tool for codifying processes that your team can activate directly from their Front conversations. By leveraging dynamic variables, you can enable them to initiate advanced workflows without the need for manual analysis or input.

Use dynamic variables with macros when:

  • You want to trigger different sets of actions based on message content.

  • You need to pass specific conversation data to another team or an external party (such as a partner or system).

  • You want to extract data from a custom field and transform it to update another custom field.


Instructions

The following steps assume you’re familiar with creating macros and using dynamic variables.

In this example, we’ll create a “Refund customer” macro that will look for a Refund approved tag and the text from the message body. If the message contains negative sentiment keywords, the macro will assign the conversation to an account owner custom field and provide a link to the subscription URL in a subscription management system.

Part 1: Create variables

Step 1

Navigate to your macro flow builder, then click Dynamic variables to create the variables for your macro.

Step 2

Click Create dynamic variable, then Create new. In this example, we’ll create variables for message body, account owner, and subscription URL fields.

Variable 1: Message body (text)

Under the "Extract message property" section, select Body. Click Save.

Variable 2: Account owner

Create a new variable. Under the "Extract conversation property" section, select Account. Click Add a step, then select your account owner custom field, then click Save.

Variable 3: Subscription URL

Create a new variable. Under the "Extract message property" section, select Body

Click Add a step. Under the “Extract” section, select Extract text. Select All occurrences in the dropdown and enter the format of the subscription ID the variable should look for.

Click Add a step. Under the “Transform” section, select Transform each element (map). Within the same container:

  • Click Add a step. Under the “Parse” section, select Parse as URL.

  • In the Parse as URL field, enter the URL that should be added as a comment.

Step 3

Click Done when you’re finished creating your variables. 

Part 2: Build macro

Step 4

In your macro Branch by condition step, click Add branch, then select the Dynamic variable is condition.

Step 5

In the Variable dropdown, select the Message body (text) variable you previously created. Select contains in the second dropdown, then enter the text you want to match on.

In the same branch, add a condition for Conversation has specific tags, then select the Refund approved tag.

Step 6

Continue adding and removing branches as needed. In this example, we have three branches.

Step 7

For each branch, set up the action(s) the macro will take. Example actions are provided below.

Branch 1: If the message body contains a negative sentiment keyword AND has the Refund approved tag, then the macro will add the Cancel Subscription tag, assign the conversation to the account owner for review, then add a comment with a link to the customer’s subscription.

Branch 2: If the conversation has the Refund approved tag, then the macro will add the Cancel Subscription tag, cancel the request in the subscription management system, then notify the account owner.

Branch 3: If the conversation does not have the Refund approved tag, then the macro add a comment to the conversation.

Step 8

Click Create to finish creating your macro.

To review how to use a macro in a conversation, see this article.


FAQ

Can I use a dynamic variable I created in another macro?

Dynamic variables are currently macro-specific. You cannot use the same dynamic variable across multiple different macros.


Pricing

This feature is available on the Scale plan or above.