# How to Use Dynamic Variables

### Messaging Console <a href="#messaging_console" id="messaging_console"></a>

You can include a dynamic variable in your message while responding to a contact. There are two ways to use dynamic variables:

1. By typing the dollar sign "$"&#x20;

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/nryjd9f0ix/1664162129225/dynamic-variables-1.gif" alt="gif showing how to add a dynamic variable in a message using the dollar sign"><figcaption></figcaption></figure>

1. By clicking on the variable Icon at the bottom of the Messages Module

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/nryjd9f0ix/1664162179709/dynamic-variables-2.gif" alt="gif showing how to add a dynamic variable in a message using the variable icon"><figcaption></figcaption></figure>

Besides contact fields, you can also include a custom field by typing the custom field's name.&#x20;

### &#x20;<a href="#snippets" id="snippets"></a>

### Snippets <a href="#snippets" id="snippets"></a>

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/nryjd9f0ix/1664162317713/dynamic-variables-3.png" alt="screenshot of the creating a snippet dialog box"><figcaption></figcaption></figure>

While composing a snippet's content, you can include a dynamic variable to personalize your quick replies.&#x20;

{% hint style="info" %}
**Tip:** You can have multiple dynamic variables in a single piece of content. Make use of them while composing your messages.
{% endhint %}

{% hint style="warning" %}
**Important:** If the field you are trying to send is empty or the field does not exist at all, the string will not be replaced.
{% endhint %}

### Workflows <a href="#workflows" id="workflows"></a>

Besides trigger variables that are tied to a specific trigger, there are also other variables that can be created and used in the Workflows.&#x20;

1. Save responses from the Contact as variables in the Ask a Question step.&#x20;

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/nryjd9f0ix/1664162451177/dynamic-variables-4.gif" alt="gif showing how to save a response to the ask a question step as a variable"><figcaption></figcaption></figure>

2. ​It is also possible to create output variables by adding Form Field in a [Shortcut Form](#workflows). The values of the variables are defined and provided by the User who initiated the Shortcut and filled out the Shortcut form.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/nryjd9f0ix/1664162521591/dynamic-variables-5.png" alt="screenshot showing how to add variable output to a form"><figcaption></figcaption></figure>

3. Then, use the dynamic variables saved in Workflow steps.

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/nryjd9f0ix/1664162722986/dynamic-variables-6.gif" alt="gif showing how to use a saved variable in a workflow step"><figcaption></figcaption></figure>

**Workflow Steps that support dynamic variables**

| Send Message          | Text                    |
| --------------------- | ----------------------- |
| Send Message          | WhatsApp Template       |
| Send Message          | Facebook Tagged Message |
| Ask a Question        | Question Text Field     |
| Branch                | Contact Field Condition |
| Branch                | Variable Condition      |
| Update Contact Field  | -                       |
| Add Comment           | -                       |
| Close Conversation    | Summary                 |
| HTTP Request          | -                       |
| Add Google Sheets Row | -                       |

{% hint style="info" %}
When verifying HTTP request outputs with dynamic variables, please note that variables without a value will result in a return of `null` or `undefined`.
{% endhint %}

### Dialogflow <a href="#dialogflow" id="dialogflow"></a>

You can also include dynamic variables in Dialogflow for the [responses](#dialogflow) and values of [parameters](/ismessenger/workspace-setting/integrations/dialogflow.md). To use dynamic variable in Dialogflow, type `$dynamic.variable`.&#x20;

**Example of usage of dynamic variables in value of parameter:**![](https://files.helpdocs.io/9e3syfbzn8/articles/nryjd9f0ix/1664163811615/dynamic-variables-7.png)

**Example of usage of dynamic variables in responses:**

<figure><img src="https://files.helpdocs.io/9e3syfbzn8/articles/nryjd9f0ix/1664163836981/dynamic-variables-8.png" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.is-messenger.com/ismessenger/contact-and-messages/untitled/how-to-use-dynamic-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
