service-digital-engagement-channel-configure
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConfiguring Enhanced Chat Channel
配置增强型聊天通道
Creates metadata XML for Salesforce Messaging for In-App and Web (MIAW). This skill produces a fully configured enhanced chat channel with routing, user verification, pre-chat, and automated response settings ready for Metadata API deployment.
MessagingChannel为Salesforce应用内和网页消息服务(MIAW)创建元数据XML。此工具可生成一个配置完整的增强型聊天通道,包含路由、用户验证、预聊天和自动回复设置,可直接通过Metadata API部署。
MessagingChannelScope
适用范围
- In scope: Creating metadata with Omni-Channel Flow routing, Omni-Channel Queue routing, or Agentforce Service Agent (ASA) routing; enabling User Verification; configuring all channel settings (pre-chat forms, automated responses, consent keywords, file attachments, custom parameters)
MessagingChannel - Out of scope: Creating the referenced Omni-Channel Flow/Queue definitions (use ), creating the Embedded Service Deployment (separate metadata type — use
automation-flow-generate), creating permission sets for messaging (useservice-digital-engagement-deployment-configure), configuring the Embedded Service Code Snippetplatform-permission-set-generate
- 包含内容:创建带有Omni-Channel Flow路由、Omni-Channel Queue路由或Agentforce Service Agent(ASA)路由的元数据;启用用户验证;配置所有通道设置(预聊天表单、自动回复、同意关键词、文件附件、自定义参数)
MessagingChannel - 不包含内容:创建关联的Omni-Channel Flow/Queue定义(使用工具)、创建Embedded Service部署(独立元数据类型——使用
automation-flow-generate工具)、创建消息服务权限集(使用service-digital-engagement-deployment-configure工具)、配置Embedded Service代码片段platform-permission-set-generate
Clarifying Questions
澄清问题
Before generating, ask the user if not already clear:
- What is the channel name / label? (used for and file name)
masterLabel - What routing type? (Omni-Channel Flow, Omni-Channel Queue, User, or Agentforce Service Agent)
- What is the routing target? (Flow API name, Queue developer name, User ID, or ASA bot name)
- For Flow, User, or ASA routing: What is the fallback queue name?
- Should User Verification be enabled? (defaults to per this skill)
true - Are there pre-chat form fields required? If so, which fields and types?
生成前若以下信息不明确,请询问用户:
- 通道名称/标签是什么?(用于和文件名)
masterLabel - 路由类型是什么?(Omni-Channel Flow、Omni-Channel Queue、用户或Agentforce Service Agent)
- 路由目标是什么?(Flow API名称、Queue开发名称、用户ID或ASA机器人名称)
- 对于Flow、用户或ASA路由:备用队列名称是什么?
- 是否应启用用户验证?(此工具默认设为)
true - 是否需要预聊天表单字段?如果需要,是哪些字段及类型?
Required Inputs
必填输入项
Gather or infer before proceeding:
- Channel name: Used for and the file name (
masterLabel)<Name>.messagingChannel-meta.xml - Routing type: One of ,
Queue,Flow, orUserAgentforceServiceAgent - Routing target: The developer name of the queue, flow, user, or ASA bot
- Fallback queue (Flow, User, and ASA): The developer name of the fallback queue for escalation
- User verification: Whether to require JWT-based identity verification (default: )
true
Defaults unless specified:
- :
messagingChannelTypeEmbeddedMessaging - :
authModeAuth - :
chatAbandonmentTimeout(minutes)5 - :
endUserIdleTimeOut(minutes)5 - :
isAttachmentUploadEnabledtrue - :
maxFileSize(MB)5 - :
allowedFileTypesbmp,csv,doc,docx,gif,jpg,pdf,png,tiff,txt,xls,xml - :
anonymousUserJwtExpirationTime(minutes, required for UnAuth, range 60-4320)360 - :
verifiedUserJwtExpirationTime(minutes, required for Auth, range 60-240)60 - :
isAbandonedChatsEnabledfalse - :
isSaveTranscriptEnabledfalse - :
isFallbackMessageEnabledfalse - :
isEstimatedWaitTimeEnabledfalse - :
isFileAttachmentExtUnrestrictedfalse - :
isQueuePositionEnabledfalse - :
isSynchronousChatEnabledfalse - :
isVoiceModeEnabledfalse
生成前需收集或推断以下信息:
- 通道名称:用于和文件名(
masterLabel)<Name>.messagingChannel-meta.xml - 路由类型:、
Queue、Flow或User中的一种AgentforceServiceAgent - 路由目标:队列、流程、用户或ASA机器人的开发名称
- 备用队列(Flow、用户和ASA路由适用):用于升级的备用队列开发名称
- 用户验证:是否需要基于JWT的身份验证(默认:)
true
未指定时采用默认值:
- :
messagingChannelTypeEmbeddedMessaging - :
authModeAuth - :
chatAbandonmentTimeout(分钟)5 - :
endUserIdleTimeOut(分钟)5 - :
isAttachmentUploadEnabledtrue - :
maxFileSize(MB)5 - :
allowedFileTypesbmp,csv,doc,docx,gif,jpg,pdf,png,tiff,txt,xls,xml - :
anonymousUserJwtExpirationTime(分钟,未验证用户必填,范围60-4320)360 - :
verifiedUserJwtExpirationTime(分钟,已验证用户必填,范围60-240)60 - :
isAbandonedChatsEnabledfalse - :
isSaveTranscriptEnabledfalse - :
isFallbackMessageEnabledfalse - :
isEstimatedWaitTimeEnabledfalse - :
isFileAttachmentExtUnrestrictedfalse - :
isQueuePositionEnabledfalse - :
isSynchronousChatEnabledfalse - :
isVoiceModeEnabledfalse
Workflow
工作流程
All steps are sequential. Do not skip or reorder.
所有步骤按顺序执行,不得跳过或重新排序。
Phase 1 — Gather Context
阶段1 — 收集上下文
-
Verify org API version — runand report any errors it returns. If the script fails, generate a
scripts/check-api-version.sh 67.0 <org-alias>in the metadata output folder withsfdx-project.json."sourceApiVersion": "67.0" -
Collect inputs — confirm the channel label, routing type, routing target, and verification settings from the user per Clarifying Questions above.
-
Determine file name — runand surface any errors it returns.
scripts/normalize-channel-name.sh "<LABEL>" -
Verify routing target exists — query the org to confirm the referenced routing target exists:
- For Queue:
sf data query --query "SELECT Id, DeveloperName FROM Group WHERE Type='Queue' AND DeveloperName='<QUEUE_NAME>'" --target-org <org-alias> - For Flow:
sf data query --query "SELECT Id, ApiName FROM FlowDefinitionView WHERE ApiName='<FLOW_NAME>' AND IsActive=true" --target-org <org-alias> - For User:
sf data query --query "SELECT Id, Username FROM User WHERE Id='<USER_ID>' AND IsActive=true" --target-org <org-alias> - For ASA:
sf data query --query "SELECT Id, DeveloperName FROM BotDefinition WHERE DeveloperName='<BOT_NAME>'" --target-org <org-alias> - Also verify the fallback queue exists (required for Flow, User, and ASA routing)
If any target is not found, inform the user and ask whether to create it. If the user confirms:- For Queue: generate a with
.queue-meta.xmlas theMessagingSessiontype and deploy it before the channelqueueSobject - For Flow/User/ASA: inform the user that the flow, user, or bot must be created separately (out of scope for this skill)
- For Queue:
-
Read the channel settings reference — loadto understand all available configuration options and their valid values.
references/channel_settings.md
-
验证组织API版本 — 运行并报告返回的任何错误。如果脚本执行失败,在元数据输出文件夹中生成
scripts/check-api-version.sh 67.0 <org-alias>,设置sfdx-project.json。"sourceApiVersion": "67.0" -
收集输入信息 — 根据上述澄清问题,向用户确认通道标签、路由类型、路由目标和验证设置。
-
确定文件名 — 运行并报告返回的任何错误。
scripts/normalize-channel-name.sh "<LABEL>" -
验证路由目标存在 — 查询组织以确认关联的路由目标存在:
- 对于Queue:
sf data query --query "SELECT Id, DeveloperName FROM Group WHERE Type='Queue' AND DeveloperName='<QUEUE_NAME>'" --target-org <org-alias> - 对于Flow:
sf data query --query "SELECT Id, ApiName FROM FlowDefinitionView WHERE ApiName='<FLOW_NAME>' AND IsActive=true" --target-org <org-alias> - 对于User:
sf data query --query "SELECT Id, Username FROM User WHERE Id='<USER_ID>' AND IsActive=true" --target-org <org-alias> - 对于ASA:
sf data query --query "SELECT Id, DeveloperName FROM BotDefinition WHERE DeveloperName='<BOT_NAME>'" --target-org <org-alias> - 同时验证备用队列是否存在(Flow、用户和ASA路由必填)
如果任何目标未找到,告知用户并询问是否创建。若用户确认:- 对于Queue:生成,将
.queue-meta.xml设为MessagingSession类型,并在部署通道前部署该文件queueSobject - 对于Flow/User/ASA:告知用户流程、用户或机器人需单独创建(不属于此工具的适用范围)
- 对于Queue:
-
阅读通道设置参考文档 — 加载以了解所有可用配置选项及其有效值。
references/channel_settings.md
Phase 2 — Generate Metadata
阶段2 — 生成元数据
-
Read the metadata template — loadas the starting structure.
assets/messaging_channel_template.xml -
Apply routing configuration — setand the corresponding handler field:
sessionHandlerTypeRouting Type sessionHandlerTypeRequired Fields Omni-Channel Queue QueuesessionHandlerQueueOmni-Channel Flow Flow+sessionHandlerFlow(fallback)sessionHandlerQueueUser User+sessionHandlerUser(fallback)sessionHandlerQueueAgentforce Service Agent AgentforceServiceAgent+sessionHandlerAsa(fallback)sessionHandlerQueue -
Apply user verification — if enabled, setto
embeddedConfig.authModeand includeAuth. If not enabled, set<messagingAuthorizations>toembeddedConfig.authModeand omitUnAuth.<messagingAuthorizations> -
Configure embedded settings — populatewith:
<embeddedConfig>- — comma-separated file extensions (no spaces)
allowedFileTypes - — JWT expiration in minutes (required for UnAuth)
anonymousUserJwtExpirationTime - — JWT expiration in minutes (required for Auth)
verifiedUserJwtExpirationTime - — minutes before abandoned conversation cleanup
chatAbandonmentTimeout - — enable abandoned chat detection
isAbandonedChatsEnabled - — file upload support
isAttachmentUploadEnabled - — show estimated wait time
isEstimatedWaitTimeEnabled - — fallback when agents unavailable
isFallbackMessageEnabled - — allow any file extension
isFileAttachmentExtUnrestricted - — save conversation transcripts
isSaveTranscriptEnabled - — maximum attachment size in MB
maxFileSize
-
Configure messaging keywords — generateelements:
<messagingKeywords>- type with individual
OptOutelements: cancel, end, quit, stop, stopall, unsubscribe<keyword> - type with
Help: help<keyword>
-
Apply standard parameters — if the user needs standard pre-chat fields, generateelements with
<standardParameters>. If the channel uses Flow-based routing and the user specifies flow variable mappings, includeparameterTypewith<actionParameterMappings>to map each parameter to a flow input variable.actionParameterName -
Apply custom parameters — if the user needs pre-chat data collection, generateelements with
<customParameters>,name,masterLabel,parameterDataType, andexternalParameterName. If the channel uses Flow-based routing and the user specifies flow variable mappings, includemaxLengthwith<actionParameterMappings>to map each parameter to a flow input variable.actionParameterName -
Generate the file — produce thefile following the template structure. Place at the path the user specifies, or default to the project's metadata source path under
.messagingChannel-meta.xml.messagingChannels/
-
读取元数据模板 — 加载作为初始结构。
assets/messaging_channel_template.xml -
应用路由配置 — 设置和对应的处理程序字段:
sessionHandlerType路由类型 sessionHandlerType必填字段 Omni-Channel Queue QueuesessionHandlerQueueOmni-Channel Flow Flow+sessionHandlerFlow(备用)sessionHandlerQueue用户 User+sessionHandlerUser(备用)sessionHandlerQueueAgentforce Service Agent AgentforceServiceAgent+sessionHandlerAsa(备用)sessionHandlerQueue -
应用用户验证设置 — 若启用验证,将设为
embeddedConfig.authMode并包含Auth。若未启用,将<messagingAuthorizations>设为embeddedConfig.authMode并省略UnAuth。<messagingAuthorizations> -
配置嵌入式设置 — 填充:
<embeddedConfig>- — 逗号分隔的文件扩展名(无空格)
allowedFileTypes - — JWT过期时间(分钟,未验证用户必填)
anonymousUserJwtExpirationTime - — JWT过期时间(分钟,已验证用户必填)
verifiedUserJwtExpirationTime - — 对话被标记为已放弃前的等待分钟数
chatAbandonmentTimeout - — 启用已放弃聊天检测
isAbandonedChatsEnabled - — 文件上传支持
isAttachmentUploadEnabled - — 显示预计等待时间
isEstimatedWaitTimeEnabled - — 坐席不可用时启用 fallback 消息
isFallbackMessageEnabled - — 允许任何文件扩展名
isFileAttachmentExtUnrestricted - — 保存对话记录
isSaveTranscriptEnabled - — 最大附件大小(MB)
maxFileSize
-
配置消息关键词 — 生成元素:
<messagingKeywords>- 类型,包含单个
OptOut元素:cancel、end、quit、stop、stopall、unsubscribe<keyword> - 类型,包含
Help:help<keyword>
-
应用标准参数 — 如果用户需要标准预聊天字段,生成带有的
parameterType元素。如果通道使用基于Flow的路由且用户指定了流程变量映射,包含带有<standardParameters>的actionParameterName,将每个参数映射到流程输入变量。<actionParameterMappings> -
应用自定义参数 — 如果用户需要收集预聊天数据,生成带有、
name、masterLabel、parameterDataType和externalParameterName的maxLength元素。如果通道使用基于Flow的路由且用户指定了流程变量映射,包含带有<customParameters>的actionParameterName,将每个参数映射到流程输入变量。<actionParameterMappings> -
生成文件 — 按照模板结构生成文件。放置在用户指定的路径,或默认放在项目元数据源路径下的
.messagingChannel-meta.xml目录中。messagingChannels/
Phase 3 — Deploy and Activate
阶段3 — 部署并激活
-
Deploy the channel — deploy the generatedfile to the target org:
.messagingChannel-meta.xmlbashsf project deploy start --source-dir <path-to-messagingChannels-folder> --target-org <org-alias> -
Activate the channel — after successful deployment, activate the messaging channel:bash
sf data update record --sobject MessagingChannel --where "DeveloperName='<CHANNEL_NAME>'" --values "IsActive=true" --target-org <org-alias>
-
部署通道 — 将生成的文件部署到目标组织:
.messagingChannel-meta.xmlbashsf project deploy start --source-dir <path-to-messagingChannels-folder> --target-org <org-alias> -
激活通道 — 部署成功后,激活消息通道:bash
sf data update record --sobject MessagingChannel --where "DeveloperName='<CHANNEL_NAME>'" --values "IsActive=true" --target-org <org-alias>
Phase 4 — Validate
阶段4 — 验证
-
Verify against checklist — confirm all items in the Verification Checklist below pass before presenting output.
-
Present output — show the generated file to the user with a summary of configured settings and confirm activation status. Offer next steps:
- Automated responses — ask if the user wants to configure (OptOutConfirmation, HelpResponse). If yes, generate elements with
<automatedResponses>,autoResponseContentType: TextResponse, and XML-escapedlanguagetext, then redeploy.response
- Automated responses — ask if the user wants to configure
-
对照检查清单验证 — 在向用户展示输出前,确认以下验证检查清单中的所有项目均通过。
-
展示输出 — 向用户展示生成的文件,附带已配置设置的摘要并确认激活状态。提供后续步骤选项:
- 自动回复 — 询问用户是否要配置(OptOutConfirmation、HelpResponse)。如果是,生成带有
<automatedResponses>、autoResponseContentType: TextResponse和XML转义language文本的元素,然后重新部署。response
- 自动回复 — 询问用户是否要配置
Rules / Constraints
规则/约束
| Constraint | Rationale |
|---|---|
| File name serves as the channel API name | No |
| Setting |
Flow routing requires both | Queue is the mandatory fallback for human escalation |
User routing requires both | Queue is the mandatory fallback when user is unavailable |
ASA routing requires both | Queue is the mandatory fallback for human escalation |
| Platform limit on channel labels |
File name must match | API name format enforced by Metadata API |
| Not a nested list or array |
| Not a comma-separated list |
| Incomplete parameters fail silently |
File extension is | Metadata API uses this specific extension |
Do not hardcode file paths — respect | Customer orgs customize source paths |
| Channel must be activated after deployment | Channels are inactive by default — messages won't route until activated |
| Platform rejects "You can't enable Session-Based Chat for verified users" for Auth channels |
| 约束 | 理由 |
|---|---|
| 文件名作为通道API名称 | XML主体中无 |
| 设置为 |
Flow路由同时需要 | 队列是人工升级的强制备用选项 |
用户路由同时需要 | 用户不可用时队列是强制备用选项 |
ASA路由同时需要 | 队列是人工升级的强制备用选项 |
| 平台对通道标签的限制 |
文件名必须匹配 | Metadata API强制的API名称格式 |
| 不是嵌套列表或数组 |
| 不是逗号分隔列表 |
| 参数不完整会静默失败 |
文件扩展名为 | Metadata API使用此特定扩展名 |
不要硬编码文件路径——遵循 | 客户组织会自定义源路径 |
| 通道必须在部署后激活 | 通道默认处于非激活状态——激活前消息无法路由 |
| 平台会拒绝已验证用户通道的设置:“无法为已验证用户启用基于会话的聊天” |
Gotchas
常见问题
| Issue | Resolution |
|---|---|
| Channel name conflicts with existing channel | Check org for existing channels; file name must be unique |
| Queue not found on deploy | Ensure the referenced queue exists and has |
| Omni-Channel Flow not found on deploy | Ensure the referenced flow exists and is active before deploying the channel |
| ASA bot reference invalid | Bot must be published and active; use exact developer name from BotDefinition metadata |
| Flow or ASA routing fails without fallback queue | |
| JWT verification not working | Connected app and certificate must be configured for the org |
| Custom parameters not collected | |
| Automated responses not showing | Use exact |
| Channel deployed but messages not routing | Channel must be activated after deployment — it defaults to inactive |
| "You can't enable Session-Based Chat for verified users" | Set |
| 问题 | 解决方法 |
|---|---|
| 通道名称与现有通道冲突 | 检查组织中的现有通道;文件名必须唯一 |
| 部署时未找到队列 | 确保关联队列存在且将 |
| 部署时未找到Omni-Channel Flow | 确保关联流程存在且在部署通道前已激活 |
| ASA机器人引用无效 | 机器人必须已发布且处于激活状态;使用BotDefinition元数据中的准确开发名称 |
| Flow或ASA路由因无备用队列失败 | 当 |
| JWT验证不生效 | 组织必须配置Connected App和证书 |
| 未收集到自定义参数 | |
| 自动回复未显示 | 使用准确的 |
| 通道已部署但消息无法路由 | 通道必须在部署后激活——默认处于非激活状态 |
| “无法为已验证用户启用基于会话的聊天” | 为已验证用户通道将 |
Verification Checklist
验证检查清单
Universal Checks
通用检查
- Does the file name match ?
^[a-zA-Z][a-zA-Z0-9_]*$ - Is 40 characters or fewer?
masterLabel - Is set to
messagingChannelType?EmbeddedMessaging
- 文件名是否匹配?
^[a-zA-Z][a-zA-Z0-9_]*$ - 是否为40个字符或更少?
masterLabel - 是否设为
messagingChannelType?EmbeddedMessaging
Routing Checks
路由检查
- Is exactly one value set (
sessionHandlerType,Queue,Flow, orUser)?AgentforceServiceAgent - Is the corresponding handler field populated (,
sessionHandlerQueue,sessionHandlerFlow, orsessionHandlerUser)?sessionHandlerAsa - For Flow, User, or ASA routing, is also populated (fallback)?
sessionHandlerQueue - Does the routing target reference an existing entity in the org?
- 是否仅设置了一个值(
sessionHandlerType、Queue、Flow或User)?AgentforceServiceAgent - 对应的处理程序字段是否已填充(、
sessionHandlerQueue、sessionHandlerFlow或sessionHandlerUser)?sessionHandlerAsa - 对于Flow、用户或ASA路由,是否同时填充了(备用)?
sessionHandlerQueue - 路由目标是否引用了组织中存在的实体?
User Verification Checks
用户验证检查
- If verification is enabled, is set to
embeddedConfig.authMode?Auth - If verification is disabled, is set to
embeddedConfig.authMode?UnAuth
- 如果启用验证,是否设为
embeddedConfig.authMode?Auth - 如果未启用验证,是否设为
embeddedConfig.authMode?UnAuth
Embedded Config Checks
嵌入式配置检查
- Is a positive integer (minutes)?
chatAbandonmentTimeout - Is a comma-separated string with no spaces?
allowedFileTypes - Is a value between 1-5 MB?
maxFileSize - If UnAuth, is set (default 360, range 60-4320)?
anonymousUserJwtExpirationTime - If Auth, is set (default 60, range 60-240)?
verifiedUserJwtExpirationTime
- 是否为正整数(分钟)?
chatAbandonmentTimeout - 是否为无空格的逗号分隔字符串?
allowedFileTypes - 是否为1-5 MB之间的值?
maxFileSize - 如果是未验证用户,是否设置了(默认360,范围60-4320)?
anonymousUserJwtExpirationTime - 如果是已验证用户,是否设置了(默认60,范围60-240)?
verifiedUserJwtExpirationTime
Automated Response Checks (only if user requested)
自动回复检查(仅当用户请求时)
- Do all values use valid IDs (
type,OptOutConfirmation)?HelpResponse - Are special characters XML-escaped in text?
response
- 所有值是否使用有效ID(
type、OptOutConfirmation)?HelpResponse - 文本中的特殊字符是否已XML转义?
response
Keyword Checks
关键词检查
- Is there at least an keyword type defined?
OptOut - Are keywords individual elements (not comma-separated)?
<keyword> - Is set on each keyword block?
language
- 是否至少定义了一个关键词类型?
OptOut - 关键词是否为单个元素(不是逗号分隔列表)?
<keyword> - 每个关键词块是否设置了?
language
Activation Checks
激活检查
- Was the channel deployed successfully?
- Was the channel activated after deployment ()?
IsActive=true
- 通道是否部署成功?
- 通道是否在部署后激活()?
IsActive=true
Output Expectations
输出预期
Deliverables:
- Messaging Channel metadata:
<source-path>/messagingChannels/<ChannelName>.messagingChannel-meta.xml
File structure follows the template in .
assets/messaging_channel_template.xml交付物:
- 消息通道元数据:
<source-path>/messagingChannels/<ChannelName>.messagingChannel-meta.xml
文件结构遵循中的模板。
assets/messaging_channel_template.xmlCross-Skill Integration
跨工具集成
| Need | Delegate to |
|---|---|
| Creating the Omni-Channel Flow for routing | |
| Creating permission sets for messaging agents | |
| Creating the Embedded Service Deployment | |
| 需求 | 委托给 |
|---|---|
| 创建用于路由的Omni-Channel Flow | |
| 为消息服务坐席创建权限集 | |
| 创建Embedded Service部署 | |
Reference File Index
参考文件索引
| File | When to read |
|---|---|
| Before generating — use as the starting structure |
| When configuring channel options beyond defaults |
| Phase 1 — verify org API version meets the passed minimum (67.0) |
| Phase 1 — derive file API name from channel label |
| To verify output for Omni-Channel Flow routing |
| To verify output for Omni-Channel Queue routing |
| To verify output for Agentforce Service Agent routing |
| 文件 | 读取时机 |
|---|---|
| 生成前——作为初始结构使用 |
| 配置默认值以外的通道选项时 |
| 阶段1——验证组织API版本是否满足最低要求(67.0) |
| 阶段1——从通道标签推导文件API名称 |
| 验证Omni-Channel Flow路由的输出时 |
| 验证Omni-Channel Queue路由的输出时 |
| 验证Agentforce Service Agent路由的输出时 |