ConversationMessageDefinition defines a reusable messaging component for an Enhanced Messaging channel or a Messaging for In-App and Web session. It combines content constants, typed parameters, presentation layouts, and optional interaction handlers. Its fullName identifies the metadata asset; constants, layouts, handlers, parameter details, and external template versions are nested configuration within that asset.
The component's top-level type, each layout's messageType, and each layout's formatType control different things: component function, message kind, and presentation. External template approval status is separate from all three and is not a general activation flag for the definition.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The metadata identity inherited from Metadata. Use this identity, rather than the user-facing label, to select a component in a deployment manifest. |
type |
Required. Identifies the component's function, such as Picklist, RecordPicker, AuthenticationRequest, PaymentRequest, or ApexForm. |
contentCategory |
Business intent, separate from component function and template approval. Documented values are AccountUpdate, Authentication, Feedback, OrderUpdate, PromotionalOutreach, Reminder, and Response. |
language |
The definition's language. An external template has a separate language under messageLayouts.externalTemplates. |
constants |
Reusable text, URLs, images, and composite content. constantType describes the constant's role; valueType describes its data type; primitiveValues.type describes its stored representation. |
messageHandlers |
Interaction handlers. Every entry requires handlerType, handlerName, and activeRequestDurationMinutes. Interpret the handler name together with its type. |
messageLayouts |
Alternative presentations within one definition. Each layout requires messageType and formatType; their names do not have to match. |
externalTemplates |
External template versions nested under a layout. Required identity and state fields include accountIdentifier, accountName, language, templateName, templateVersionIdentifier, and status. |
collectionType |
Required on layout items. Values are None, StaticList, and DynamicList. A dynamic list can iterate stored constants rather than query records. |
valueSourceReference |
Binds a composite value, primitive value, or merge field to its source. A value such as Constants.Options is an internal content binding, not a reference to another metadata asset. |
mergeFields |
Assembles repeated values into text. Each merge field requires name, formulaTemplate, valueSourceReference, and mergeFieldType, whose allowed value is ListTemplate. |
parameters |
Typed component inputs. Required parameterType values are CustomPrimitive, CustomComposite, and RecordIds. |
optionsParameter |
A separate typed structure for options. Required optionsParameterType values are CustomPrimitiveOptions, CustomCompositeOptions, RecordIdOptions, and TimeSlotOptions. |
isList, isRequired, maxListItems
|
Parameter-detail constraints. Both Boolean flags default to false; maxListItems specifies the maximum allowed list size. These fields do not grant or restrict access. |
Behavior and Constraints
Component function and layout presentation
A definition can contain multiple layouts. For example, a Picklist can contain Buttons, ListPicker, and Carousel layouts with messageType=Choices, plus a Text layout with messageType=StaticContent. These are different representations of the same component. Their presence or order alone does not establish which layout a channel selects or any execution order.
contentCategory records business intent, not component behavior or template approval. Authentication and Response are valid documented values even though the exposed element enumeration omits them. An enumeration limited to AccountUpdate, Feedback, OrderUpdate, PromotionalOutreach, and Reminder is incomplete.
Constants and layout bindings
Text and images entered when a component is created in the UI are saved as standard constants. Custom constants can also be added. Constant roles include Custom, Image, Options, SubTitle, Title, and Url.
Keep a constant's role, data type, and stored representation separate. An image-valued constant can use valueType=ImageId with primitiveValues.type=ImageAsset and contentAssetName naming the asset. Layout primitives use a different type enumeration: it includes MediaAsset and SourcePrimitiveValue, but not ImageAsset.
Layouts can obtain values from literals, media, internal value sources, record fields, or formulas. Composite layout values group nested layoutItems and can bind an entire collection through valueSourceReference. For example, a composite can bind Constants.Options, while a nested primitive reads Constants.Options.ListItem.Title. Consequently, collectionType=DynamicList does not necessarily mean the options come from Salesforce records.
A layout primitive's formulaTemplate can combine text with repeated values supplied through mergeFields. Each merge field has its own name, formula template, and source reference. These internal bindings are part of the component's content structure; do not classify every valueSourceReference as an external dependency.
Handlers and active requests
Handler types include ApexFormProvider, AuthProvider, PaymentProvider, QuickAction, and Survey. The handler type enumeration also exposes CatalogProvider and PaymentStatusProvider.
Depending on the handler, handlerName can reference an Apex class, authentication provider, quick action, or payment gateway provider. These are alternative reference destinations, not prerequisites that every component must satisfy. activeRequestDurationMinutes specifies how long the request remains active; it is not a presentation setting.
External template identity and status
External template configuration belongs under messageLayouts.externalTemplates. For WhatsApp, accountIdentifier is the WhatsApp Business Account identifier, or WABA ID. The entry's language is separate from the definition's top-level language. An external template entry also exposes its own type, with values Flow, Legacy, and Template; this is not the definition's top-level type.
Interpret status for the specific external account and template version:
-
Pendingmeans the version awaits Meta's approval;Rejectedmeans Meta rejected it during review. -
Disabledindicates recurring negative customer feedback. -
Pausedindicates recurring negative customer feedback or low read rates. -
OutOfSyncmeans the messaging service and Salesforce hold different template versions. - Other states are
Approved,Blocked,Deleted,InAppeal,LimitExceeded, andPendingDeletion.
These states belong to an external template version, not to the overall definition. A stored account identifier and template reference do not establish that a destination account has the same approved template. Template-level errorCode, errorMessage, and rejectionReason can hold diagnostic details; interpret them in the context of that account and version.
Parameter structure
parameters and optionsParameter describe separate typed structures. Both can include primitive details or composite details, where a composite groups multiple child values. Composite details can recursively contain compositeChildItems and primitiveChildItems.
Primitive details can specify valueType and sobjectType, the Salesforce object type. The isList, isRequired, and maxListItems constraints apply within these structures, including nested children. They describe input shape and requiredness, not access control.
Deployment and Retrieval
Metadata API files use the suffix .conversationMessageDefinition and reside in the conversationMessageDefinitions folder. In package.xml, use ConversationMessageDefinition as the type name and the component's metadata name as the member. The type supports * to select all members. See Deploying and Retrieving Metadata with the Zip File for manifest handling.
The definition is the deployment asset. Its constants, layouts, handler entries, parameter details, and external template versions remain nested within it; they are not separate deployment identities.
Determine deployment dependencies from references actually present in the definition. A component that names a content asset, custom field, custom object, or handler has a different dependency scope from one that uses only internal constants. The set of possible reference destinations does not mean every provider, object, field, asset, or bot belongs in the deployment.
When moving a definition that contains external templates, distinguish the stored account and template version from approval in the destination account. The stored reference alone does not establish that the same approved external template exists there.
For change or removal impact, inspect consumers that actually reference the definition: bots, bot versions, bot blocks, bot templates, and translations. A possible schema relationship does not establish that a particular consumer uses the component.
A reported deployment failure, Could not infer a metadata type, was resolved by updating the Salesforce CLI in affected environments. This failure can therefore require a tooling diagnosis rather than a change to the component's layout or content configuration.
Relationships
External dependencies appear throughout the nested configuration, not just at the top level. contentAssetName can occur in constant or layout primitive values; fieldName occurs in layout primitives; and sobjectType can occur in primitive parameter details, including nested children and option details. Handler destinations depend on the handler configuration.
References
-
ApexClass:handlerName. -
AuthProvider:handlerName. -
ContentAsset:contentAssetName. -
CustomField:fieldName. -
CustomObject:sobjectType. -
PaymentGatewayProvider:handlerName. -
QuickAction:handlerName.
Referenced By
-
Bot:messageDefinitionName. -
BotVersion:messageDefinitionName. -
BotBlock:messageDefinitionName. -
BotTemplate:messageDefinitionName. -
Translations:name.
Reported Issues
-
Validation and deployment can fail because the local tooling does not recognize the type. In a 2024 report, CI/CD and some local environments returned
Could not infer a metadata typeforComForum.conversationMessageDefinition-meta.xml, while other environments did not. The accepted answer attributed the difference to an older Salesforce CLI and reported resolution after runningsf updatelocally andsudo npm update --global @salesforce/cliin Jenkins. See the CLI deployment failure discussion.
Common Questions
Why does deployment say "Could not infer a metadata type" for ConversationMessageDefinition?
A community report traced this error to an older Salesforce CLI in CI/CD and affected local environments. Updating the CLI resolved the reported failure; it was not resolved by changing the component's content or layouts.
What is the difference between type, messageType, and formatType?
The top-level type identifies component function. A layout's messageType identifies its message kind, and formatType identifies presentation. For example, a Picklist can use messageType=Choices with formatType=Buttons.
Does DynamicList mean the component queries Salesforce records?
No. A DynamicList can iterate predefined Constants.Options. Inspect its valueSourceReference and nested bindings to determine the source of its values.
Does deploying an external template reference mean it is approved in the destination account?
No. The stored account identifier and template reference do not establish approval in the destination account. Status and diagnostic fields apply to the specific external account and template version.
Which components can be affected when I remove a ConversationMessageDefinition?
Check actual references from Bot, BotVersion, BotBlock, and BotTemplate through messageDefinitionName, and from Translations through name. Only references present in actual assets establish the affected scope.