Global Variables - System Variables Reference for ChatMaxima
Reference for ChatMaxima Global Variables (sys_ system fields) used to personalize bots, broadcasts, and auto replies with contact and session data.
Overview
Global Variables, also called System Variables, are built-in placeholders that ChatMaxima resolves automatically at runtime. They give you access to information about the current contact, conversation, message, platform, and media without any setup. Every Global Variable starts with the sys_ prefix and is wrapped in single curly braces, like {sys_account_contact_name}.
Use Global Variables anywhere you need to personalize content, route conversations, or pass context into integrations: bot builder blocks, broadcast templates, auto replies, message templates, and API or webhook payloads.
How to Insert a Global Variable
In any supported input field, simply type { and a picker appears listing every available Global Variable and Custom Attribute. Select the one you want and ChatMaxima inserts it in the correct format.
- Click into the field where you want to insert the variable
- Type a single opening curly brace
{ - Choose the variable from the dropdown that appears
- The picker inserts the full token, for example
{sys_account_contact_name}
Note: Variable names are case-sensitive. Always use single curly braces around the variable name.
Supported Global Variables
| Variable | Description |
|---|---|
{sys_account_contact_name} | Name of the contact associated with the chatbot session |
{sys_account_contact_email} | Email address of the contact interacting with the chatbot |
{sys_account_contact_mobile} | Mobile number associated with the contact's account |
{sys_contact_reference_id} | Reference id for the current conversation |
{sys_current_message} | Current message being processed in a bot |
{sys_account_platform} | Channel the current conversation is running on. See Accepted values for sys_account_platform |
{sys_current_date_time} | Current date and time at the moment of execution |
{sys_current_page_url} | URL of the webpage where the chatbot is currently active |
{sys_current_conversation} | Complete conversation history including messages and timestamps |
{sys_ai_intent} | Detected intent from the user's query in MaxIA blocks (for example, general_query, human_agent, booking_request) |
{sys_ai_response} | The most recent MaxIA (AI) reply generated in this conversation |
{sys_current_media} | URL, type, and filename of the most recent media (image, video, audio, document) uploaded by the user, as a JSON object. Use {sys_current_media.url} or {sys_current_media.type} for specific fields |
{sys_contact_metadata} | The contact's stored metadata as a JSON object, including Click to WhatsApp (CTWA) ad referral details. See Contact Metadata and Ad Attribution |
Contact Variables
These resolve to data stored against the contact profile.
{sys_account_contact_name}is the most common variable for personalization. Use it in greetings, broadcast templates, and confirmation messages.{sys_account_contact_email}and{sys_account_contact_mobile}are useful for passing identity into webhooks, CRM sync, and verification flows.{sys_contact_reference_id}uniquely identifies the conversation thread, useful when correlating events across systems.
Conversation Variables
These describe the current message and history.
{sys_current_message}holds the text the user just sent. Use it to echo input back, log it, or pass it to an API block.{sys_current_conversation}contains the full chat history with timestamps, useful for AI summarization or handoff context.
Channel and Context Variables
{sys_account_platform}lets you branch logic by channel, for example sending a different message on WhatsApp than on the Web Widget.{sys_current_page_url}captures where the visitor was on your site when they started chatting. Useful for routing or analytics.{sys_current_date_time}stamps the moment of execution, helpful for timestamps in tickets or downstream systems.
Accepted Values for sys_account_platform
{sys_account_platform} resolves to a fixed, human-readable channel label. It is set at the start of every bot step from the channel the inbound message arrived on, so it is always one of the values below and never a free-form string.
| Value | Channel |
|---|---|
Whatsapp | WhatsApp via the Meta Cloud API (the standard WhatsApp channel) |
Whatsapp (Twilio) | WhatsApp connected through a Twilio number |
Web | Website live chat widget |
Facebook | Facebook Messenger |
Instagram | Instagram Direct Messages |
Telegram | Telegram |
Twitter | Twitter / X Direct Messages |
SMS | SMS |
Twilio Voice | Twilio Voice call |
NA | Any other or unrecognized source, for example an API-triggered or internally initiated session |
Note: The values are matched exactly, including the capitalization and the space in
Whatsapp (Twilio). When you compare{sys_account_platform}in a Conditional Block, use
To treat both WhatsApp channels the same way, add two conditions on the same branch: one for Whatsapp and one for Whatsapp (Twilio).
AI and Media Variables
{sys_ai_intent}is populated by MaxIA blocks after intent detection. Branch your bot based on whether the user wantshuman_agent,booking_request,general_query, and so on.{sys_ai_response}holds the answer text MaxIA generated most recently in the conversation. It is written every time a MaxIA block returns a successful reply, and each new reply overwrites the previous one.{sys_current_media}is a JSON object describing the most recent file the user sent. Access individual fields with dot notation:
{sys_current_media.url}
{sys_current_media.type}
{sys_current_media.filename}
Contact Metadata and Ad Attribution
{sys_contact_metadata} returns the contact's stored metadata as a JSON object. Its most useful content is the Click to WhatsApp (CTWA) ad referral: when a WhatsApp conversation starts from a Click to WhatsApp ad, ChatMaxima captures the referral Meta sends with that first message and keeps it on the contact under the ctwa_referral key.
Access individual fields with dot notation:
{sys_contact_metadata.ctwa_referral.ctwa_clid}
{sys_contact_metadata.ctwa_referral.source_id}
{sys_contact_metadata.ctwa_referral.source_type}
{sys_contact_metadata.ctwa_referral.source_url}
{sys_contact_metadata.ctwa_referral.captured_datetime}
| Field | Description |
|---|---|
ctwa_clid | The Click to WhatsApp click id. Pass this to the Meta Conversions API to attribute a conversion back to the ad |
source_id | Id of the ad or post that produced the click |
source_type | Whether the click came from an ad or an organic post |
source_url | The ad or post URL |
captured_datetime | When ChatMaxima first recorded the referral, in YYYY-MM-DD HH:MM:SS |
Meta may also include creative details such as headline, body, and media_type on the referral. Anything Meta sends is stored as-is, so you can read those fields the same way when they are present.
Note: Ad attribution is first touch. The first ad that brought a contact in is preserved and never overwritten by later ad clicks from the same contact. Contacts that did not arrive from an ad have no
ctwa_referralkey, so these paths resolve to empty rather than failing.
Global Variables vs Custom Attributes
ChatMaxima supports two types of dynamic placeholders. Both appear in the same { picker.
| Global Variables | Custom Attributes | |
|---|---|---|
| Prefix | sys_ | None (you choose the name) |
| Created by | ChatMaxima (built-in) | You, in Contacts settings |
| Examples | {sys_account_contact_name}, {sys_current_message} | {company_name}, {order_id}, {plan_type} |
| Source of value | Session, contact profile, message, or platform context | Stored against each contact, populated manually, by CSV import, by bot block, or by API |
| Use when | The data is something ChatMaxima already knows | The data is specific to your business logic |
Where to Use Global Variables
Global Variables work across the platform wherever the { picker is available:
- Bot Builder blocks: Send Message, Send Email, API Block, Webhook Block, Conditional Block, Set Attribute Block, and most other blocks accept variables in their text and parameter fields.
- Broadcast templates: Map approved WhatsApp template placeholders (
{{1}},{{2}}) to Global Variables when creating a broadcast. - Auto replies and canned responses: Personalize away-messages and saved replies.
- Knowledge Base AI prompts: Pass session context into your AI agent's system prompt.
- Webhooks and integrations: Include variables in webhook URLs, headers, and request bodies to forward context to external systems.
Example Use Cases
Personalize a WhatsApp broadcast
Approved template:
Hello {{1}}, your order {{2}} has been confirmed.
In the broadcast composer, map {{1}} to {sys_account_contact_name} and {{2}} to your custom attribute {order_id}. Each recipient receives a message such as "Hello Priya, your order ORD-1042 has been confirmed."
Greet by name in a bot
Drop a Send Message block at the start of your flow with:
Hi {sys_account_contact_name}, how can we help you today?
If the contact has no name on file, the placeholder resolves to empty, so add a fallback branch when needed.
Route by AI intent
Use {sys_ai_intent} in a Conditional Block after a MaxIA block:
- If
{sys_ai_intent}equalshuman_agent, route to live chat - If
{sys_ai_intent}equalsbooking_request, jump to your booking flow - Otherwise, continue with the FAQ flow
Reuse the AI answer later in the flow
{sys_ai_response} carries the last MaxIA reply forward, so you can act on the answer the AI just gave without asking the model again. For example, after a MaxIA block, add a Send Email block that mails the transcript to your team:
Subject: AI answered a question from {sys_account_contact_name}
Question: {sys_current_message}
Detected intent: {sys_ai_intent}
MaxIA replied: {sys_ai_response}
Channel: {sys_account_platform}
The same variable works in a Create Ticket block, an API Block body, or a follow-up message such as "Did that answer your question?" after the AI response.
Branch by channel
Use {sys_account_platform} in a Conditional Block to change behaviour per channel:
- If
{sys_account_platform}equalsWeb, offer the callback request form - If
{sys_account_platform}equalsWhatsapp, send an interactive button message instead - Otherwise, fall back to a plain text menu
Pass context into a webhook
In a Webhook Block body:
{
"name": "{sys_account_contact_name}",
"phone": "{sys_account_contact_mobile}",
"message": "{sys_current_message}",
"platform": "{sys_account_platform}",
"page": "{sys_current_page_url}"
}
ChatMaxima replaces every variable with the live value before sending the request.
Attribute a lead back to the ad that produced it
When a contact arrives from a Click to WhatsApp ad, send the referral fields into your CRM or ads reporting from an API Block:
{
"name": "{sys_account_contact_name}",
"phone": "{sys_account_contact_mobile}",
"ctwa_clid": "{sys_contact_metadata.ctwa_referral.ctwa_clid}",
"ad_id": "{sys_contact_metadata.ctwa_referral.source_id}",
"source_type": "{sys_contact_metadata.ctwa_referral.source_type}",
"ad_url": "{sys_contact_metadata.ctwa_referral.source_url}",
"clicked_at": "{sys_contact_metadata.ctwa_referral.captured_datetime}"
}
You can also branch on {sys_contact_metadata.ctwa_referral.source_id} in a Conditional Block to run a campaign-specific flow for the contacts that came from one particular ad.
Forward an uploaded file to your backend
If a user sends an image and you need to save it server-side, use:
{
"file_url": "{sys_current_media.url}",
"file_type": "{sys_current_media.type}",
"file_name": "{sys_current_media.filename}"
}
Best Practices
- Validate your contact data: If a Global Variable like
{sys_account_contact_mobile}is missing for a contact, the placeholder resolves to empty. Clean your contact data before broadcasting. - Combine with Custom Attributes: Use Global Variables for identity and session data, and Custom Attributes for business-specific fields like order numbers, plan types, or appointment dates.
- Test before sending: Run a test broadcast or bot session against your own contact record to confirm every variable resolves correctly.
- Use dot notation for JSON variables:
{sys_current_media}and{sys_contact_metadata}return JSON objects. Always access specific fields like{sys_current_media.url}or{sys_contact_metadata.ctwa_referral.ctwa_clid}instead of dropping the full object into a message. - Avoid hardcoding: Wherever you would otherwise type a contact's name, mobile, or email, reach for a Global Variable instead.
Troubleshooting
Variable shows as literal text in the output
- Check that the variable is wrapped in single curly braces, not double:
{sys_account_contact_name}is correct,{{sys_account_contact_name}}is not (double braces are the Meta template placeholder syntax, used only inside approved WhatsApp templates). - Confirm the spelling matches the picker exactly. Variables are case-sensitive.
- Make sure you are using the variable in a supported field. Some plain-text fields outside the bot, broadcast, and template editors do not parse variables.
Variable resolves to empty
- Check that the underlying data exists on the contact profile (for example, the contact actually has a name or mobile saved).
- For
{sys_ai_intent}, confirm that a MaxIA block ran before the point where the variable is used. - For
{sys_ai_response}, confirm that a MaxIA block ran earlier in the flow and completed without an error. The variable is written only after a successful AI reply, so it stays empty if the AI call failed, and it is not updated when the MaxIA answer is delivered as a WhatsApp button or list message. - For
{sys_current_media}, confirm that the user has sent media in this session. - For
{sys_contact_metadata.ctwa_referral.*}, confirm the contact actually started the conversation from a Click to WhatsApp ad. Contacts who messaged you directly, or who came in on another channel, have no referral stored, so these paths are empty by design.
Channel comparison never matches
- Compare against the exact labels listed in Accepted values for sys_account_platform. The comparison is case-sensitive, so
Whatsappmatches andWhatsAppdoes not. - Remember that WhatsApp on the Meta Cloud API resolves to
Whatsappwhile a Twilio-connected WhatsApp number resolves toWhatsapp (Twilio). Cover both if you support both. - If the value is
NA, the session did not arrive from a supported messaging channel, for example a bot triggered through the API.
Need a value ChatMaxima does not expose
If the value you need is not in the Global Variables list, create a Custom Attribute and populate it through the contact profile, a CSV import, an API call, or a Set Attribute bot block.