---
title: "Dynamic Tokens"
url: "https://help.magicblocks.ai/en/article/dynamic-tokens"
language: "en"
last_updated: "2026-03-18T08:29:04.451Z"
---

# Dynamic Tokens

Dynamic Tokens let your AI Agent personalize messages and automate responses with live data — like names, times, contacts, or custom variables.  
They turn your chat replies from static to contextual.

Dynamic Tokens are **variables** your AI Agent can use to pull or insert real-time information inside conversations, forms, and automations.

They act as placeholders — automatically filled in by data from users, contact forms, or external systems.

For example:

> “Hi **`{{name}}`**, welcome back! Let’s pick up where we left off.”

Tokens make your AI feel personal, smart, and human — without manual scripting.

## When to Use

Use **Dynamic Tokens** when you want your Agent to:

-   Personalize greetings and responses
-   Pass user data between Journey blocks
-   Insert real-time info from forms or external APIs
-   Display results from a Function or Webhook
-   Reuse context across multiple blocks or sessions
-   They’re the building blocks of adaptive, data-aware conversations.

## How It Works

Tokens follow a simple pattern:

`{{token_name}}`

MagicBlocks automatically replaces the token with the latest known value during a conversation.

You can use tokens in:

-   Messages and prompts
-   Snippets and Tasks
-   Actions and follow-ups
-   Webhook payloads
-   Email or SMS notifications

## Token Sources

| Token Type | Description | Example |
| --- | --- | --- |
| **System Tokens** | Auto-generated data (like session info, timestamps, device type). | `{{session_id}}`<br>,<br>`{{date}}`<br>,<br>`{{device}}` |
| **User Tokens** | Collected from form inputs or chat messages. | `{{name}}`<br>,<br>`{{email}}`<br>,<br>`{{company}}` |
| **Journey Tokens** | Data passed between blocks within the same conversation. | `{{user_goal}}`<br>,<br>`{{contact_stage}}` |
| **Dynamic Tokens** | Generated from Functions or Webhooks. | `{{quote_amount}}`<br>,<br>`{{crm_status}}` |
| **Custom Tokens** | Defined by you in Tasks, Snippets, or Scripts. | `{{agent_tagline}}`<br>,<br>`{{special_offer}}` |

### Example

#### **Before Tokens:**

> “Hi! Thanks for chatting with us.”

#### **With Tokens:**

> “Hi **`{{name}}`**, thanks for chatting with **`{{company_name}}`**! We’ll send a confirmation to **`{{email}}`** shortly.”

💡 The same message can instantly adapt to every user, every time — no hardcoding required.

## How to Add Tokens

#### **1\. From a Form**

Create a form field (e.g. Name, Email, Company).

Each field automatically becomes a token.

Example: `Name → {{name}}`, `Email → {{email}}`.

Use those tokens anywhere in your Journey or Actions.

#### **2\. From a Function**

Output data in your Function as a named variable.

Reference it in chat using `{{function_variable_name}}`.

Example:

Function outputs `{ "quote_total": "$249" }`

Use `{{quote_total}}` in your reply.

#### **3\. From a Webhook**

Capture response data from an external system (like CRM or Google Sheet).

Map values to tokens in your payload or Action.

Example:

CRM returns `{"status": "Qualified"}`

Use `{{status}}` in your Journey message.

#### **4\. From Manual Input**

Define your own static or temporary tokens using Snippets or Tasks.

Great for brand constants like `{{company_name}}` or `{{cta_button}}`.

## Advanced Use Cases

| Use Case | How Tokens Help |
| --- | --- |
| **Contact Personalization** | “Hey {{name}}, your quote for {{product}} is ready.” |
| **CRM Updates** | Insert<br>`{{contact_stage}}`<br>or<br>`{{deal_value}}`<br>pulled from your CRM webhook. |
| **Scheduling** | Show available slots using<br>`{{calendar_time}}`<br>. |
| **Multi-Language Support** | Insert translated strings or language codes dynamically. |
| **Multi-Agent Context** | Pass<br>`{{agent_name}}`<br>or<br>`{{agent_goal}}`<br>across blocks. |

## Token Management

You can view, edit, or test your tokens in:

**Journey Block → Advanced → Settings**

**Forms** (auto-generated tokens)

**Functions** (custom variable outputs)

**Webhook Payloads** (response mapping)

*Tip:* Always use lowercase and underscores for token names — e.g., `{{user_email}}`, not `{{User Email}}`.

## Common Mistakes

| Issue | Cause | Fix |
| --- | --- | --- |
| Token shows as text (<br>`{{name}}`<br>) | No value assigned yet | Ensure it’s captured from a form or webhook |
| Wrong value | Token overwritten by later block | Check Journey order and variable names |
| Empty field | Function or webhook didn’t return data | Verify API response format |
| Formatting errors | Missing curly braces or spaces | Use<br>`{{token_name}}`<br>exactly |
| Unexpected capitalization | Case mismatch | Use consistent lowercase tokens |

## Best Practices

-   Use descriptive names — `{{user_email}}` > `{{email}}`
-   Keep tokens consistent across the workspace
-   Use Snippets for reusable phrases with tokens
-   Test tokens in **Try My Agent** after setup
-   Avoid exposing sensitive info (like passwords or IDs)

## Why It Matters

Dynamic Tokens make your AI **feel alive and aware**.  
They ensure every reply sounds like it was written *just for that user* — not copied from a script.

In practice, they:

-   Increase engagement and trust
-   Enable automation without losing personality
-   Keep your data synchronized across systems

### FAQs

**Q: Can I use tokens in Actions or Forms?**  
Yes — tokens work in messages, forms, actions, and webhook payloads.

**Q: What happens if a token has no value?**  
It will render as blank. Add fallback text in your message:  
`{{name | fallback: "there"}} → "Hi there!"`

**Q: Are tokens case-sensitive?**  
Yes. `{{Name}}` ≠ `{{name}}`. Always use consistent lowercase.

**Q: Can I create global tokens for all Agents?**  
Currently, tokens are Agent-specific. Use Snippets or Key Facts for global variables.

## Related Articles

[Advanced Overview](https://help.magicblocks.ai/en/article/dynamic-tokens#)

[Functions](https://help.magicblocks.ai/en/article/dynamic-tokens#)

[Webhooks](https://help.magicblocks.ai/en/article/dynamic-tokens#)

[Journey Advanced](https://help.magicblocks.ai/en/article/dynamic-tokens#)

[Snippets](https://help.magicblocks.ai/en/article/dynamic-tokens#)

[Forms](https://help.magicblocks.ai/en/article/dynamic-tokens#)
