Variables for incoming messages
Every $EMAILDATA and $IMDATA variable an AI agent flow can use, the categories a reply is sorted into, and which other variables work in these flows.
You’ll need: An AI agent with an AI Tasks or response flow.
AI agent flows have two families of variables of their own. $EMAILDATA
variables belong to email, $IMDATA variables to WhatsApp and SMS. Some hold
the lead’s reply; others make the AI write a message.
#The reply itself
These are filled in a response flow, from the message that started it. In an AI Tasks flow they are empty.
| Variable | Holds |
|---|---|
$EMAILDATA.BODY |
The text of the email. Long emails are cut at 2,500 characters. It can include the quoted earlier thread. |
$EMAILDATA.SUBJECT |
The email’s subject line. |
$EMAILDATA.EMAIL |
The address the email came from. |
$EMAILDATA.CC |
The addresses copied on the email. |
$EMAILDATA.CATEGORY |
The category the email was sorted into (below). |
$IMDATA.BODY |
The text of the WhatsApp or SMS message. |
$IMDATA.PHONE |
The number the message came from. |
$IMDATA.CATEGORY |
The category the message was sorted into. |
$EMAILDATA.EMAIL and $EMAILDATA.CC work in message text and recipient
lists, but not on the left side of a Split condition.
#Messages the AI writes
Put one of these in a message box and the AI writes the message in its place, in the agent’s language.
| Variable | Writes | Follows |
|---|---|---|
$EMAILDATA.AIRESPONSE |
An email answering the lead’s reply, with the reply quoted below a line | Response Instructions |
$EMAILDATA.AIFIRST |
A first email to the lead | First Contact Message |
$EMAILDATA.AIFOLLOWUP |
A follow-up email | Follow-Up Message |
$EMAILDATA.AISORRY |
An apology email | your sorry instructions |
$EMAILDATA.AITRANSFER |
An email saying a person will take over | your transfer instructions |
$EMAILDATA.AISUBJECT |
One subject line, 75 characters at most, different from subjects already sent to this lead | Email Subject |
$IMDATA.AIRESPONSE |
A WhatsApp or SMS answer to the lead’s message | Response Instructions |
$IMDATA.AIFIRST |
A first WhatsApp or SMS message | First Contact Message |
$IMDATA.AIFOLLOWUP |
A follow-up WhatsApp or SMS message | Follow-Up Message |
How to create the sorry and transfer instructions is in Create an AI agent
and tell it how to write.
Every AI message also draws on your Business Info prompt, the agent group’s Instructions, and what the AI knows about the lead: name, business, notes and the conversation so far.
Format. Email variables produce formatted email text, with links ready to
click. $IMDATA variables produce plain chat text, at most about 120 words,
with WhatsApp-style bold and emoji allowed.
One AI message per box. If a message box contains two of these variables,
the AI writes one message and both get the same text. Use separate steps.
$EMAILDATA.AISUBJECT in the Subject and another AI variable in the body
is fine.
#Categories
Every reply is sorted into one category. The code is what
$EMAILDATA.CATEGORY or $IMDATA.CATEGORY holds.
| Code | The lead… |
|---|---|
accepted_offer |
Accepted a meeting or call, or asked when you are available |
quote |
Asked for a quote or prices |
question |
Asked questions about the business or product |
more_info |
Asked for more details or documents before deciding |
call |
Asked for a phone call |
sms |
Asked to be sent a text message |
referral |
Referred you to someone else |
forwarded_internal |
Forwarded your message to colleagues |
follow_up |
Asked you to get in touch again later |
interested_not_ready |
Is interested, but not ready yet |
feedback |
Gave feedback on the message or the product |
already_customer |
Says they are already a customer |
dissatisfied_current |
Is unhappy with a competitor they use now |
not_interested |
Is not interested, without complaining |
technical_issues |
Reports a problem with the message or its links |
bad_experience |
Had a bad experience with your company |
automated |
Sent an automatic reply |
out_of_office |
Is out of the office |
not_found |
Fits none of the above |
Unsubscribe requests and spam complaints are handled before any flow runs and
never reach it. On email, so do bounces, ticket-system replies, automatic
replies and out-of-office messages; see Handle
replies. On WhatsApp and SMS, automated and
out_of_office do reach the flow.
#Other variables in AI agent flows
| Works | Holds here |
|---|---|
$CRMDATA.* |
The lead’s contact record, including your custom fields |
$FLOWASSIGNED.FNAME, .LNAME, .EMAIL, .PHONE |
The agent |
$ACCOUNTNAME, $ACCOUNTFIRSTNAME, $ACCOUNTLASTNAME, $ACCOUNTEMAIL, $ACCOUNTPHONE |
The agent, not the account owner |
$FLOWSESSION |
An identifier for this run of the flow |
$ + an identifier |
A value stored earlier in the flow by AI Prompt or API/Webhook Call |
FLOW.CALCULATE, FLOW.FORMATDATE and the other formulas |
As everywhere; see Formulas and JSON |
These have no value in an AI agent flow, because there is no web visit behind
it: the $UTM_ variables, $FLOWPARAMETER, $FLOWPOINTS, $COUNTRY, the
dataset, booking and payment variables. The full list is in the variable
reference.
Updated: