Newer Version Available

This content describes an older version of this product. View Latest

Bot

Represents a definition of an Einstein Bot configuration that can have one or more versions. Only one version can be active. This type extends the Metadata metadata type and inherits its fullName field.

File Suffix and Directory Location

Bot components have the suffix .bot and are stored in the bot folder.

Version

Bot components are available in API version 43.0 and later.

Special Access Rules

Bot is available only if Chat and Einstein Bots are enabled in your org.

Fields

Field Name Field Type Description
botMlDomain LocalMlDomain Represents the Einstein intent set that groups intents, entities, and variables associated with a bot. All Einstein Bot versions under the same bot now share an intent set. Available in API version 44.0 and later.
botUser string Represents a user profile associated with the bot. Available in API version 46.0 and later.
botVersions BotVersion Represents the configuration details for a specific Einstein Bots version, including dialogs, intents, entities, and variables.
contextVariables ConversationContextVariable Represents the context variables that enable your bot to gather customer information regardless of channel. Available in API 45.0 and later.
description string A description of the bot.
label string Label that identifies the bot throughout the Salesforce user interface.
logPrivateConversationData boolean Specifies whether to log customer inputs as part of conversation data (true) or not (false). Available in API version 48.0 and later.

ConversationContextVariable

A context variable local to the current bot version. Available in API version 45.0 and later.

Field Name Field Type Description
contextVariableMappings ConversationContextVariableMapping Represents the mapping between a context variable, channel type, and sObject field.
dataType ConversationDataType (enumeration of type string) Required. Represents the data type of the context variable. Valid values are:
  • Text
  • Number
  • Boolean
  • Object
  • Date
  • DateTime
  • Currency
  • Id
developerName string Required. Represents the name of the context variable. Can contain only underscores and alphanumeric characters and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
label string Required. A label that identifies the context variable throughout the Salesforce user interface.
SObjectType string Valid values are:
  • BotDefinition
  • Queue

ConversationContextVariableMapping

Represents the mapping between a context variable, channel type, and sObject field.

Field Name Field Type Description
fieldName string Required. The API name of an SObject field to be used as part of the mapping.
messageType MessageType (enumeration of type string) Required. Represents the channel, either SMS messaging or Chat. Valid values are:
  • Text
  • Facebook
  • Line
  • GoogleHome
  • Alexa
  • Omega
  • AppleBusinessChat
  • WeChat
  • WebChat
  • WhatsApp
  • Phone
SObjectType string Required. SObject type for the field property defined as part of the mapping. Valid values are:
  • LiveChatTranscript
  • MessagingEndUser
  • MessagingSession

LocalMlDomain

An Einstein Intent Set local to the current bot version.

Field Name Field Type Description
label string Label that represents an Einstein Intent Set local to the current bot version throughout the Salesforce user interface.
mlIntents MlIntent[] List of intents associated with this local intent set.
mlSlotClasses MlSlotClass[] List of entities associated with this local intent set.
name string Required. This unique name prevents conflicts with other local Einstein Intent Sets. This name can contain only underscores and alphanumeric characters and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.

Declarative Metadata Sample Definition

The following is an example of a Bot. This example has been trimmed to make it easier to read.

1<?xml version="1.0" encoding="UTF-8"?>
2<Bot xmlns="http://soap.sforce.com/2006/04/metadata">
3    <botMlDomain>
4        <label>Astros Pizza</label>
5        <mlIntents>
6            <developerName>New_Order</developerName>
7            <label>New Order</label>
8            <mlIntentUtterances>
9                <utterance>Today is pie day so I want pie</utterance>
10            </mlIntentUtterances>
11        </mlIntents>
12        <mlSlotClasses>
13            <developerName>Size</developerName>
14            <extractionType>Value</extractionType>
15            <label>Size</label>
16            <mlSlotClassValues>
17                <synonymGroup>
18                    <languages>en_US</languages>
19                    <terms>Big</terms>
20                    <terms>Extra Large</terms>
21                    <terms>X-Large</terms>
22                    <terms>Grande</terms>
23                    <terms>Huge</terms>
24                </synonymGroup>
25                <value>Large</value>
26            </mlSlotClassValues>
27        </mlSlotClasses>
28        <name>Astros_Pizza_ld1</name>
29    </botMlDomain>
30    <botVersions>
31        <fullName>v1</fullName>
32        <botDialogGroups>
33            <developerName>Order_Management</developerName>
34            <label>Order Management</label>
35        </botDialogGroups>
36        <botDialogs>
37            <botDialogGroup>Order_Management</botDialogGroup>
38            <botSteps>
39                <botMessages>
40                    <message>🍕🍕🍕Pizza Time! 🍕🍕🍕</message>
41                </botMessages>
42                <type>Message</type>
43            </botSteps>
44            <botSteps>
45                <botStepConditions>
46                    <leftOperandName>Verified_User</leftOperandName>
47                    <leftOperandType>ConversationVariable</leftOperandType>
48                    <operatorType>Equals</operatorType>
49                    <rightOperandValue>false</rightOperandValue>
50                </botStepConditions>
51                <botSteps>
52                    <botNavigation>
53                        <botNavigationLinks>
54                            <targetBotDialog>Customer_Verification</targetBotDialog>
55                        </botNavigationLinks>
56                        <type>Call</type>
57                    </botNavigation>
58                    <type>Navigation</type>
59                </botSteps>
60                <type>Group</type>
61            </botSteps>
62            <botSteps>
63                <botStepConditions>
64                    <leftOperandName>Location</leftOperandName>
65                    <leftOperandType>ConversationVariable</leftOperandType>
66                    <operatorType>IsNotSet</operatorType>
67                </botStepConditions>
68                <botSteps>
69                    <botNavigation>
70                        <botNavigationLinks>
71                            <targetBotDialog>Select_Location</targetBotDialog>
72                        </botNavigationLinks>
73                        <type>Call</type>
74                    </botNavigation>
75                    <type>Navigation</type>
76                </botSteps>
77                <type>Group</type>
78            </botSteps>
79            <botSteps>
80                <botVariableOperation>
81                    <botInvocation>
82                        <invocationActionName>CreateOrderService</invocationActionName>
83                        <invocationActionType>apex</invocationActionType>
84                        <invocationMappings>
85                            <parameterName>customer</parameterName>
86                            <type>Input</type>
87                            <variableName>Contact</variableName>
88                            <variableType>ConversationVariable</variableType>
89                        </invocationMappings>
90                        <invocationMappings>
91                            <parameterName>location</parameterName>
92                            <type>Input</type>
93                            <variableName>Location</variableName>
94                            <variableType>ConversationVariable</variableType>
95                        </invocationMappings>
96                        <invocationMappings>
97                            <parameterName>output</parameterName>
98                            <type>Output</type>
99                            <variableName>Pizza_Order</variableName>
100                            <variableType>ConversationVariable</variableType>
101                        </invocationMappings>
102                    </botInvocation>
103                    <type>Set</type>
104                </botVariableOperation>
105                <type>VariableOperation</type>
106            </botSteps>
107            <botSteps>
108                <botMessages>
109                    <message>Perfect, let&apos;s work on your order from our {!Location.Name} location</message>
110                </botMessages>
111                <type>Message</type>
112            </botSteps>
113            <botSteps>
114                <botNavigation>
115                    <botNavigationLinks>
116                        <targetBotDialog>Add_Items_to_Order</targetBotDialog>
117                    </botNavigationLinks>
118                    <type>Redirect</type>
119                </botNavigation>
120                <type>Navigation</type>
121            </botSteps>
122            <developerName>New_Order</developerName>
123            <label>New Order</label>
124            <mlIntent>New_Order</mlIntent>
125            <showInFooterMenu>false</showInFooterMenu>
126        </botDialogs>
127        <conversationVariables>
128            <dataType>Object</dataType>
129            <developerName>Contact</developerName>
130            <label>Contact</label>
131        </conversationVariables>
132        <conversationVariables>
133            <dataType>Text</dataType>
134            <developerName>Delivery_Address</developerName>
135            <label>Delivery Address</label>
136        </conversationVariables>
137        <conversationVariables>
138            <dataType>Object</dataType>
139            <developerName>Pizza_Order</developerName>
140            <label>Pizza Order</label>
141        </conversationVariables>
142        <entryDialog>Welcome</entryDialog>
143        <mainMenuDialog>Main_Menu</mainMenuDialog>
144    </botVersions>
145    <contextVariables>
146        <contextVariableMappings>
147            <SObjectType>LiveChatTranscript</SObjectType>
148            <fieldName>LiveChatTranscript.ChatKey</fieldName>
149            <messageType>WebChat</messageType>
150        </contextVariableMappings>
151        <dataType>Text</dataType>
152        <developerName>ChatKey</developerName>
153        <label>Chat Key</label>
154    </contextVariables>
155    <contextVariables>
156        <contextVariableMappings>
157            <SObjectType>LiveChatTranscript</SObjectType>
158            <fieldName>LiveChatTranscript.ContactId</fieldName>
159            <messageType>WebChat</messageType>
160        </contextVariableMappings>
161        <dataType>Id</dataType>
162        <developerName>ContactId</developerName>
163        <label>Contact Id</label>
164    </contextVariables>
165    <contextVariables>
166        <contextVariableMappings>
167            <SObjectType>LiveChatTranscript</SObjectType>
168            <fieldName>LiveChatTranscript.LiveChatVisitorId</fieldName>
169            <messageType>WebChat</messageType>
170        </contextVariableMappings>
171        <dataType>Id</dataType>
172        <developerName>EndUserId</developerName>
173        <label>End User Id</label>
174    </contextVariables>
175    <contextVariables>
176        <contextVariableMappings>
177            <SObjectType>LiveChatTranscript</SObjectType>
178            <fieldName>LiveChatTranscript.Id</fieldName>
179            <messageType>WebChat</messageType>
180        </contextVariableMappings>
181        <dataType>Id</dataType>
182        <developerName>RoutableId</developerName>
183        <label>Routable Id</label>
184    </contextVariables>
185    <label>Astro&apos;s Pizza</label>
186</Bot>

The following is an example package.xml that references the previous definition.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>Pizza_Bot</members>
5        <name>Bot</name>
6    </types>
7    <version>45.0</version>
8</Package>

Wildcard Support in the Manifest File

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.