Prompt Context Variables
What are Context Variables?
Context variables are placeholders in prompts that are replaced with actual values at runtime. They enable dynamic, personalized interactions without manual customization for each user or situation.
A context variable takes the form {VARIABLE_NAME}. When the agent processes the prompt, the variable is replaced with its actual value.
Example: "Hello {USER_FIRST_NAME}! Today is {TODAY_DATE}." becomes "Hello John! Today is March 5, 2026."
Available Context Variables
| Variable | Replaced With | Example Value | Resolved |
|---|---|---|---|
| {USER_NAME} | User's full name | John Smith | Per conversation |
| {USER_FIRST_NAME} | User's first name | John | Per conversation |
| {USER_EMAIL} | User's email address | john@example.com | Per conversation |
| {USER_ACCOUNT_NAME} | The account name linked to a portal user's contact (empty for internal users without a contact) | Acme Properties | Per conversation |
| {CONVERSATION_ID} | The current conversation record Id — useful for audit-style instructions | aX0… | Per conversation |
| {USER_CONTEXT_DATA} | A formatted block describing the running user (used by the built-in prompts) | — | Per conversation |
| {RECORD_CONTEXT_DATA} | The formatted record-context block for the record page the conversation runs on | — | Per conversation |
| {TODAY_DATE} | Today's date | 2026-03-05 | At assembly (cache-friendly) |
| {AGENT_NAME} | The agent's Display Name | Sales Assistant | At assembly (cache-friendly) |
| {AGENT_CHANNEL} | The channel the conversation is running on | Internal | At assembly (cache-friendly) |
| {USER_LANGUAGE} | The user's Salesforce language locale | es_MX | At assembly (cache-friendly) |
| {USER_LANGUAGE_CODE} | Just the language portion of the locale | es | At assembly (cache-friendly) |
Using Context Variables in Prompts
Context variables can be used in any prompt type and any field:
"Hello {USER_FIRST_NAME}! I'm {AGENT_NAME}, your personal sales assistant. How can I help you close deals today?"
"When responding to {USER_FIRST_NAME}, use their preferred communication style: direct and concise. Always include {TODAY_DATE} in any timeline estimates."
"User {USER_NAME} ({USER_EMAIL}) is accessing this agent in conversation {CONVERSATION_ID}. Log all interactions for compliance. Escalate sensitive data requests to management."
Personalization Examples
Sales Agent with Personalization
Without variables (generic):
"You are a sales assistant helping close deals."
With variables (personalized):
"You are {USER_FIRST_NAME}'s personal sales assistant. Help {USER_FIRST_NAME} close deals, manage opportunities, and track progress. Today is {TODAY_DATE}."
Each user gets a persona tailored to them.
Support Agent with Date Context
Without variables:
"Help customers resolve support tickets."
With variables:
"Help customers resolve support tickets. Current date: {TODAY_DATE}. When discussing timelines, always reference this current date. Respond in the user's language ({USER_LANGUAGE})."
Your own template tokens are left alone
The twelve variables above are the ones REDA AI resolves. If your organisation has its own templating
— tokens you fill in from somewhere else, or leave for a person to complete — write them with
double braces, for example {{ORG_NAME}}.
REDA AI does not resolve double-brace tokens, and the AI-assisted tools are explicitly told to leave them
intact: both the Prompt Optimizer and
Build Agent with AI are instructed to keep every
{{…}} token exactly as written — never stripping it, resolving
it, renaming it or filling in a value. So a prompt can go through an optimisation pass without losing your
placeholders.
The distinction is worth keeping straight: single braces are REDA AI’s and get replaced at assembly time; double braces are yours and survive untouched.
Variable Availability by Channel
The agent and date variables resolve on every channel. The user variables depend on there being an authenticated person:
- Internal and API channels — user variables resolve from the running Salesforce user.
- Community channel — user variables resolve from the portal user; {USER_ACCOUNT_NAME} fills with the account linked to their contact.
- External Widget — there is no authenticated person, so the user variables are stripped: they are replaced with empty text, never sent to the AI, and never shown literally. Write prompts for this channel so they read naturally without the user variables.
An unknown variable name (a typo, or a variable that doesn't exist) is different: it is not replaced at all and reaches the AI literally — see Troubleshooting below.
Best Practices for Context Variables
Variables should enhance the interaction. Avoid overusing them — a prompt with {USER_FIRST_NAME} mentioned in every sentence feels awkward. Use sparingly for natural personalization.
Verify Variable Availability — Before using a variable in an External Widget agent, confirm it's available in that channel. TEST in production to ensure variables are replaced correctly.
Handle Gracefully When Variables Are Missing — Write prompts that work even if a variable isn't replaced. Example: "Hello {USER_FIRST_NAME}! (or whoever you are)" vs. "Hello {USER_FIRST_NAME}!" (breaks if variable missing).
Use Timezone-Aware Dates — {TODAY_DATE} respects the user's timezone and locale. Use it for any time-sensitive instructions. Avoid hardcoded dates.
Respect User Privacy — Don't expose {USER_EMAIL} unless necessary. Use {USER_FIRST_NAME} for personalization without oversharing data.
Common Patterns
"Hi {USER_FIRST_NAME}! Welcome back. Today is {TODAY_DATE}."
"You're assisting {USER_NAME} from {USER_ACCOUNT_NAME}. Tailor your responses to their role and expertise level. Today is {TODAY_DATE}."
"Log all interactions. User: {USER_NAME}, Email: {USER_EMAIL}, Conversation: {CONVERSATION_ID}, Date: {TODAY_DATE}."
"The user's language is {USER_LANGUAGE}. Respond in that language and use its conventions. Today is {TODAY_DATE}."
Troubleshooting Variables
Verify the variable name is exactly correct (case-sensitive). {USER_FIRST_NAME} works; {User_First_Name} does not. Also remember that on the External Widget channel the user variables are stripped to empty text.
Unexpected Value in Variable — Some variables depend on Salesforce settings. {USER_LANGUAGE} is based on the user's Salesforce language setting. If it's wrong, update the user's language in their personal settings.
Variable Appears Literally in Response — If the prompt contains {UNKNOWN_VAR}, the AI might echo it back. Only use variables from the available list.
Frequently Asked Questions
Currently, you can only use the predefined variables listed above. Custom variables are not supported. If you need additional context, use context fields or pass data through the agent configuration.
Variables work in prompts. Context fields use Salesforce field API names and don't support variables. For dynamic field mapping, use prompts with field descriptions instead.
If a user's first name is not set ({USER_FIRST_NAME} is empty), the variable is replaced with an empty string. Write prompts that handle this gracefully, or make the variable optional: "Hello {USER_FIRST_NAME} (or friend)!"
No. Suggestion chip labels are static. You can use variables in the Message field (what gets sent when clicked), but not in the Label (button text).
Next Steps
Review prompt creation for examples of variables in action, or explore prompt best practices for more guidance.