BotTemplate defines an Einstein Bot template's conversation design, including dialogs, variables, system-event handling, and a local Einstein Intent Set. It controls how the template starts a conversation, collects customer input, recognizes intents, invokes actions, and routes between dialogs.
The dialogs, steps, variables, and intent definitions nested inside a template are part of the BotTemplate component. They are not separate Bot or BotVersion components.
Key Elements
| Element | What the Element Controls |
|---|---|
masterLabel |
Required user-facing label for the template. It is distinct from the component's inherited fullName. |
type |
Configuration category. The documented values are Bot, the default Einstein Bot configuration; ExternalCopilot, an external-facing agent; and InternalCopilot, an internal-facing agent. |
richContentEnabled |
Template compatibility: true makes it available for enhanced bots; false, the default, makes it available for standard bots. |
conversationLanguages |
Required string specifying the template's language. |
mlDomain |
Required local Einstein Intent Set containing intents, entities, and associated variables. |
contextVariables |
Customer information gathered across channels. Nested contextVariableMappings select an object field for each messageType. |
conversationVariables |
Data collected or produced during a conversation, including action inputs and outputs. visibility accepts Internal or External; collectionType=List identifies a list variable. |
includeInPrompt |
On context and conversation variables, determines whether the variable enters prompts sent to the Agentforce model. When true, it also appears in the Included Fields UI section. |
botDialogs |
Dialogs and their nested botSteps, including messages, actions, navigation, variable operations, record lookups, and system messages. |
entryDialog, mainMenuDialog
|
References to the first dialog presented to the customer and the main menu dialog, respectively. |
conversationSystemDialogs |
Assigns dialogs to system events, such as ErrorHandling, TransferFailed, and Disambiguation. |
botDialogGroups |
Defines organizational groups. A dialog joins a group through its botDialogGroup value; grouping does not define execution order. |
conversationGoals, conversationStepGoalMappings
|
Defines named goals and associates individual steps with those goals through goalName. |
permissionSet |
References the permission set associated with the template. It does not embed the permission set's grants. |
conversationRecordLookup |
Configures an object lookup, its conditions, selected fields, result variable, and sorting. Required maxLookupResults accepts only 1 through 3. |
Behavior and Constraints
Availability and template compatibility
BotTemplate is available only when both Chat and Einstein Bots are enabled in the org. Bot metadata deployment and retrieval are not supported for Lead Nurturing and Sales Coach Agents.
type and richContentEnabled answer different compatibility questions. The first identifies the configuration category; the second distinguishes enhanced-bot templates from standard-bot templates. richContentEnabled is not merely a switch for displaying richer messages.
The permissionSet association alone does not establish access to every object, field, or action referenced by the template.
Variables and model input
A context variable can obtain its value from different fields on different channels. Each contextVariableMappings entry connects SObjectType and fieldName to a particular messageType.
Conversation variables store information collected or produced during the conversation and can supply action inputs or receive action outputs. Their settings describe separate aspects of the value:
-
visibility=Internalallows the variable to be set only by action outputs.visibility=Externalalso allows it to be set through the API. -
dataTypeidentifies the stored data type:Boolean,Currency,Date,DateTime,Id,Number,Object, orText. -
SObjectTypeidentifies the object type associated with an ID stored in the variable. -
collectionType=Listidentifies a list rather than a scalar value.
For both context and conversation variables, includeInPrompt=true includes the variable in prompts sent to the Agentforce model and shows it in Included Fields. Treat this as a model-input decision, not just a display setting. Variable description text can also be used by the Agentforce planner service.
Dialog routing and conditional steps
Entry, menu visibility, and system-event routing are independent settings. entryDialog selects the first dialog, while mainMenuDialog selects the main menu. A dialog's showInFooterMenu controls whether it appears in the Bot Options menu; it does not assign the dialog an entry or system-event role. Its default is false.
conversationSystemDialogs maps a dialog to a system-event type. Supported event values are Disambiguation, DisambiguationFailed, ErrorHandling, KnowledgeAction, KnowledgeFallback, and TransferFailed.
Steps can contain nested botSteps. Their botStepConditions combine through conditionLogicType, using And or Or. A condition's rightOperandValue is ignored when operatorType is IsSet or IsNotSet.
Navigation uses Call, Redirect, or TransferToAgent. Within botNavigationLinks, targetBotDialog names the destination dialog. For a Redirect with multiple links, a link's label supplies its displayed label; if omitted, the target dialog's label is used.
In a template that is not associated with a bot block, a dialog's isPlaceholderDialog is read-only and false.
Intent recognition and input collection
The required mlDomain is the local Einstein Intent Set. Dialogs connect to intents through mlIntent. A dialog's mlIntentTrainingEnabled=true enables intent-model training; false, the default, uses exact matching.
Entity definitions under mlSlotClasses describe how to extract values from customer input. Use extractionType=Pattern with extractionRegex, or extractionType=Value with configured values and synonyms.
These settings on botVariableOperation materially change input collection:
-
askCollectIfSet=trueasks again and overwrites an existing value. Withfalse, the default, collection is skipped when the variable already has a value. -
ignoreIntentRecognition=truerepeats a Question step until the response meets the entity requirements, instead of recognizing another intent from invalid input. -
optionalCollect=trueallows one repair attempt before moving to the next dialog step. The default isfalse. -
autoSelectIfSingleChoice=trueautomatically selects the sole available Dynamic Collect choice. Withfalse, the default, the bot presents the choice and waits for a response.
Actions, messaging components, and record lookups
A botInvocation can appear directly in a step or inside botVariableOperation. Its invocationActionType determines how to interpret invocationActionName, including references to Apex classes, flows, or external services. The nested invocationMappings distinguish Input, Output, and Error mappings and connect action parameters to literal values or variables.
A messageDefinitionName references a messaging component. This connection can also appear directly in a step or inside a variable operation.
conversationRecordLookup combines an object, conditions, filterLogic, selected lookupFields, and a targetVariableName for the results. maxLookupResults must be between 1 and 3. The lookup-level sortOrder values Asc and Desc control result display order, not dialog-step execution order. This differs from the integer sortOrder inside each condition, which identifies the order in which conditions are applied.
Deployment and Retrieval
BotTemplate components use the .botTemplate suffix and reside in the botTemplates folder. In package.xml, use BotTemplate as the type name. The type supports * as a wildcard member for retrieval.
The component inherits fullName from the base metadata type. Its masterLabel, conversationLanguages, and mlDomain are required. Dialogs, steps, variables, groups, and the local intent set remain nested content of the template, rather than separate Bot or BotVersion deployment components.
Dependencies can be several levels below the template root. Inspect invocations inside variable operations as well as direct step invocations. Also inspect context-variable mappings, conversation-variable object types, record-lookup objects and fields, variable-operation operands, and messaging-component references.
For dialog and dialog-group developerName values, use names that begin with a letter and contain only alphanumeric characters and underscores. They cannot end with an underscore or contain consecutive underscores. Dialog names cannot contain spaces.
Preserve translation identifiers when editing or regenerating a template. messageIdentifier, stepIdentifier, quickReplyOptionIdentifier, and variableOperationIdentifier link content to translated labels. The UI generates these identifiers automatically, but they are required when creating the corresponding content through the API. Each can contain up to 255 alphanumeric characters, dashes, and underscores. Changing an identifier can affect translation linkage even if the visible conversation text stays the same.
Relationships
Dependencies are carried by nested element values, not just top-level settings. SObjectType connects context variables, conversation variables, mappings, and record lookups to object definitions. Field dependencies can occur in mapping fields, lookup selections, lookup conditions, and sorting. Under botVariableOperation.botVariableOperands, sourceType determines how to interpret sourceName; entity-based sources can also identify an entity through sourceType=MlSlotClass.
References
-
ApexClass:invocationActionName. -
Bot:sourceName. -
ConversationMessageDefinition:messageDefinitionName. -
CustomField:fieldName,leftOperand,sortFieldName,sourceName. -
CustomObject:SObjectType. -
ExternalServiceRegistration:invocationActionName. -
Flow:invocationActionName,sourceName. -
PermissionSet:permissionSet. -
Queue:sourceName.
Referenced By
-
Translations:fullName.
Documentation Inconsistencies
The exposed type enumeration includes AgentforceOrchestrator, but the documented BotTemplate value list includes only Bot, ExternalCopilot, and InternalCopilot. The schema therefore exposes a value that the template's documented value list does not explain.
Common Questions
Where are BotTemplate files stored, and can I retrieve them with a wildcard?
Files are stored in botTemplates with the .botTemplate suffix. A package.xml entry with type BotTemplate supports the wildcard member *.
What must be enabled to deploy or retrieve BotTemplate metadata?
Both Chat and Einstein Bots must be enabled in the org. Bot metadata deployment and retrieval are not supported for Lead Nurturing and Sales Coach Agents.
Does richContentEnabled just turn rich messages on or off?
No. It controls template compatibility: true makes the template available for enhanced bots, and false, the default, makes it available for standard bots. The separate type field identifies the configuration category.
Why does a bot ask for a variable that already has a value?
Check askCollectIfSet on the variable operation. When true, the bot asks again and overwrites the existing value. When false, the default, it skips collection for a variable that already has a value.
Does includeInPrompt only control the Included Fields display?
No. On context and conversation variables, includeInPrompt=true includes the variable in prompts sent to the Agentforce model. Appearing in the Included Fields section is an additional UI effect.