service-digital-engagement-messaging-site-integrate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEmbed Messaging Widget on an Experience Cloud Site
在Experience Cloud站点中嵌入消息组件
Wires an existing Embedded Messaging (MIAW) deployment onto an Experience Cloud site by retrieving the site's bundle (LWR or Aura ), patching the home page JSON to place the component, staging the bundle into the local project, deploying it, publishing the site, and verifying guest access.
DigitalExperienceBundleExperienceBundleexperience_messaging:embeddedMessagingThe operation is idempotent: if the component is already present it is updated in place (its is preserved), so re-running with different ESD coordinates cleanly updates.
id通过检索站点包(LWR 或 Aura )、修补主页JSON以添加组件、将包暂存到本地项目、部署、发布站点并验证访客访问权限,将现有的嵌入式消息(MIAW)部署关联到Experience Cloud站点。
DigitalExperienceBundleExperienceBundleexperience_messaging:embeddedMessaging该操作具有幂等性:如果组件已存在,则会就地更新(保留其),因此使用不同ESD坐标重新运行可干净完成更新。
idScope
范围
- In scope: Detecting LWR vs Aura bundle type; scaffolding missing LWR template routes required by the site template (e.g. ); patching the home-page JSON to insert or update the Embedded Messaging component; staging the bundle into
too-many-requests; async deploy with polling; resolving theforce-appand publishing the site; guest-URL smoke test; manual Experience Builder fallback with a deep link.Network.Name - Out of scope: Creating the (Embedded Service Deployment) itself — use
EmbeddedServiceConfig; creating theservice-digital-engagement-deployment-configure— useMessagingChannel; creating the Experience Cloud site itself — useservice-digital-engagement-channel-configure; generating a standalone JS snippet for a non-Experience website.experience-lwr-site-generate
- 包含范围:检测LWR与Aura包类型;搭建站点模板所需的缺失LWR模板路由(如);修补主页JSON以插入或更新嵌入式消息组件;将包暂存到
too-many-requests;异步部署并轮询;解析force-app并发布站点;访客URL冒烟测试;提供带深度链接的Experience Builder手动回退方案。Network.Name - 排除范围:创建(嵌入式服务部署)本身——请使用
EmbeddedServiceConfig;创建service-digital-engagement-deployment-configure——请使用MessagingChannel;创建Experience Cloud站点本身——请使用service-digital-engagement-channel-configure;为非Experience网站生成独立JS代码片段。experience-lwr-site-generate
Clarifying Questions
澄清问题
Before executing, ask the user if not already clear:
- Site name? The of the Experience Cloud site (the metadata folder name under
DeveloperNameordigitalExperiences/site/<siteName>/).experiences/<siteName>/ - Deployment coordinates? The (Embedded Service Deployment
deploymentName), theDeveloperName, and thescrtUrl(Experience site base URL). All three come from the publishedsiteEndpoint— obtain fromEmbeddedServiceConfigoutput if not provided.service-digital-engagement-deployment-configure - Target org alias? For the commands.
sf - URL path prefix? The site's (needed to resolve
UrlPathPrefixfor publish and to hit the guest URL for verification).Network.Name
执行前,若以下信息不明确,请询问用户:
- 站点名称? Experience Cloud站点的(
DeveloperName或digitalExperiences/site/<siteName>/下的元数据文件夹名称)。experiences/<siteName>/ - 部署坐标? (嵌入式服务部署的
deploymentName)、DeveloperName和scrtUrl(Experience站点基础URL)。这三项均来自已发布的siteEndpoint——若未提供,可从EmbeddedServiceConfig的输出中获取。service-digital-engagement-deployment-configure - 目标组织别名? 用于命令。
sf - URL路径前缀? 站点的(解析
UrlPathPrefix以完成发布,以及访问访客URL进行验证时需要)。Network.Name
Required Inputs
必填输入
Gather or infer before proceeding:
- Site name — of the site
DeveloperName - Deployment name — of the
DeveloperNameEmbeddedServiceConfig - scrtUrl — SCRT2 endpoint URL from the deployment
- siteEndpoint — Base URL of the Experience site
- Target org alias
- URL path prefix — Site's public URL path segment (e.g. )
esw-site
Defaults applied to the component's attributes when writing:
- :
isExpSiteAuthModefalse - :
hideChatButtonOnLoad"Default" - :
clientVersion"WebV1"
执行前需收集或推断以下信息:
- 站点名称 —— 站点的
DeveloperName - 部署名称 —— 的
EmbeddedServiceConfigDeveloperName - scrtUrl —— 部署中的SCRT2端点URL
- siteEndpoint —— Experience站点的基础URL
- 目标组织别名
- URL路径前缀 —— 站点的公共URL路径段(如)
esw-site
写入组件属性时应用以下默认值:
- :
isExpSiteAuthModefalse - :
hideChatButtonOnLoad"Default" - :
clientVersion"WebV1"
Workflow
工作流程
Steps are sequential. If any automated step fails, proceed to the manual fallback (Phase 6) and do not claim the widget is "live" until either the guest-URL smoke test returns or the user confirms manual publish.
200步骤按顺序执行。若任何自动化步骤失败,进入手动回退阶段(第6阶段),且仅当访客URL冒烟测试返回或用户确认手动发布后,才可声称组件已“上线”。
200Phase 1 — Detect Bundle Type
阶段1 —— 检测包类型
-
Retrieve both candidate bundles into. The script only performs a deterministic path check, so the retrieve calls must run first:
<retrieve-dir>bashsf project retrieve start --metadata "DigitalExperienceBundle:site/<siteName>" \ --target-org <org-alias> --target-metadata-dir <retrieve-dir> sf project retrieve start --metadata "ExperienceBundle:<siteName>" \ --target-org <org-alias> --target-metadata-dir <retrieve-dir>Either call may return "no metadata found" — that is expected; the missing bundle simply means the site is the other type. -
Run. It emits exactly one token to stdout:
scripts/detect_bundle_type.sh <retrieve-dir> <siteName>- → the LWR marker file exists (
LWR). Go to Phase 2.digitalExperiences/site/<siteName>/sfdc_cms__view/home/content.json - → the Aura marker file exists (
AURA). Go to Phase 3.experiences/<siteName>/views/homeGuestLayout.json - (exit code 1) → neither marker exists. Skip to the manual fallback in Phase 6.
UNKNOWN
Read for retrieval command shapes and troubleshooting.
references/bundle_detection.md-
将两个候选包检索到中。脚本仅执行确定性路径检查,因此必须先运行检索命令:
<retrieve-dir>bashsf project retrieve start --metadata "DigitalExperienceBundle:site/<siteName>" \ --target-org <org-alias> --target-metadata-dir <retrieve-dir> sf project retrieve start --metadata "ExperienceBundle:<siteName>" \ --target-org <org-alias> --target-metadata-dir <retrieve-dir>任一命令可能返回“未找到元数据”——这是预期情况;缺失的包仅表示站点为另一种类型。 -
运行。它会向标准输出输出恰好一个标记:
scripts/detect_bundle_type.sh <retrieve-dir> <siteName>- → 存在LWR标记文件(
LWR)。进入阶段2。digitalExperiences/site/<siteName>/sfdc_cms__view/home/content.json - → 存在Aura标记文件(
AURA)。进入阶段3。experiences/<siteName>/views/homeGuestLayout.json - (退出代码1) → 两个标记文件均不存在。跳至阶段6的手动回退。
UNKNOWN
有关检索命令格式和故障排除,请阅读。
references/bundle_detection.mdPhase 2 — Patch the LWR Bundle
阶段2 —— 修补LWR包
-
Scaffold any missing LWR template routes (commonly) before patching — missing routes fail the deploy. Route+view scaffolding is owned by
too-many-requests(see itsexperience-lwr-site-generate,configure-content-route.md, andconfigure-content-view.md). Delegate to that skill for the actual scaffold; this skill only supplies the messaging-specific context (which route the deploy is complaining about, and confirmation that the scaffolded pair resolves that specific deploy error). Seehandle-component-and-region-ids.mdfor the delegation pointer.references/lwr_route_scaffolding.md -
Patch the home page by running:bash
scripts/patch_lwr_bundle.sh \ <retrieve-dir>/digitalExperiences/site/<siteName>/sfdc_cms__view/home/content.json \ <deploymentName> <scrtUrl> <siteEndpoint>The script deterministically walks, targets the region with.contentBody.component.children[]and.type == "region", and either updates the existing.name == "content"component in place (preserving its.definition == "experience_messaging:embeddedMessaging") or appends a freshidwrapper with a JSON-stringcommunity_layout:section. SeesectionConfigfor the JSON shapes it emits and how to verify.references/lwr_patch.md -
Proceed to Phase 4.
-
搭建任何缺失的LWR模板路由(通常为)后再进行修补——缺失路由会导致部署失败。路由+视图搭建由
too-many-requests负责(请参阅其experience-lwr-site-generate、configure-content-route.md和configure-content-view.md)。将实际搭建工作委托给该技能,本技能仅提供消息相关上下文(部署报错的路由,以及确认搭建的路由对可解决该特定部署错误)。有关委托指引,请参阅handle-component-and-region-ids.md。references/lwr_route_scaffolding.md -
通过运行以下命令修补主页:bash
scripts/patch_lwr_bundle.sh \ <retrieve-dir>/digitalExperiences/site/<siteName>/sfdc_cms__view/home/content.json \ <deploymentName> <scrtUrl> <siteEndpoint>脚本会确定性遍历,定位.contentBody.component.children[]且.type == "region"的区域,要么就地更新现有的.name == "content"组件(保留其.definition == "experience_messaging:embeddedMessaging"),要么附加一个新的id包装器及JSON字符串格式的community_layout:section。有关其输出的JSON格式及验证方法,请参阅sectionConfig。references/lwr_patch.md -
进入阶段4。
Phase 3 — Patch the Aura Bundle
阶段3 —— 修补Aura包
-
Patch the home guest layout by running:bash
scripts/patch_aura_bundle.sh \ <retrieve-dir>/experiences/<siteName>/views/homeGuestLayout.json \ <deploymentName> <scrtUrl> <siteEndpoint>The script iterates, picks the first region whose.regions[]is non-empty, recurses through any.components[]wrappers, and either updates the existingforceCommunity:sectioncomponent in place (preserving.componentName == "experience_messaging:embeddedMessaging") or appends a freshidwrapper. Aura usesforceCommunity:section/componentName(notcomponentAttributes/definition) and has noattributes. SeedxpStylefor JSON shapes and verification steps.references/aura_patch.md -
Proceed to Phase 4.
-
通过运行以下命令修补主页访客布局:bash
scripts/patch_aura_bundle.sh \ <retrieve-dir>/experiences/<siteName>/views/homeGuestLayout.json \ <deploymentName> <scrtUrl> <siteEndpoint>脚本会遍历,选择第一个.regions[]非空的区域,递归遍历所有.components[]包装器,要么就地更新现有的forceCommunity:section组件(保留.componentName == "experience_messaging:embeddedMessaging"),要么附加一个新的id包装器。Aura使用forceCommunity:section/componentName(而非componentAttributes/definition),且无attributes。有关JSON格式及验证步骤,请参阅dxpStyle。references/aura_patch.md -
进入阶段4。
Phase 4 — Stage and Deploy
阶段4 —— 暂存与部署
-
Copy the modified bundle into the project's default package. Useso unchanged files travel with the modified one:
cp -R- LWR:
cp -R <retrieve-dir>/digitalExperiences force-app/main/default/ - Aura: and also copy the sibling
cp -R <retrieve-dir>/experiences force-app/main/default/file — Aura deploys are rejected without it.<siteName>.site-meta.xml
- LWR:
-
Async deploy and poll:bash
sf project deploy start --source-dir force-app/main/default \ --target-org <org-alias> --asyncPoll every 15 seconds up to 10 minutes:bashsf project deploy report --job-id <job-id> --target-org <org-alias>Stop when status is,Succeeded,Failed, orSucceededPartial. On failure, surface the deploy report and do not proceed to publish. SeeCanceledfor the full polling loop and common failure modes.references/deploy_and_publish.md
-
将修改后的包复制到项目的默认包中。使用命令,确保未修改的文件与修改后的文件一同复制:
cp -R- LWR:
cp -R <retrieve-dir>/digitalExperiences force-app/main/default/ - Aura:同时复制同级的
cp -R <retrieve-dir>/experiences force-app/main/default/文件——缺少该文件会导致Aura部署被拒绝。<siteName>.site-meta.xml
- LWR:
-
异步部署并轮询:bash
sf project deploy start --source-dir force-app/main/default \ --target-org <org-alias> --async每15秒轮询一次,最多轮询10分钟:bashsf project deploy report --job-id <job-id> --target-org <org-alias>当状态为、Succeeded、Failed或SucceededPartial时停止轮询。若部署失败,展示部署报告且不继续执行发布步骤。有关完整轮询循环和常见失败模式,请参阅Canceled。references/deploy_and_publish.md
Phase 5 — Publish and Verify
阶段5 —— 发布与验证
-
Resolve the.
Network.Namefrequently differs from the siteNetwork.Name, so query it by the URL path prefix rather than guessing:DeveloperNamebashsf data query --query \ "SELECT Name FROM Network WHERE UrlPathPrefix='<urlPath>' LIMIT 1" \ --target-org <org-alias> -
Publish the community with the resolved name:bash
sf community publish --name "<resolved-Name>" --target-org <org-alias> -
Smoke-test guest access by hitting the public URL:bash
curl -sL -o /dev/null -w "%{http_code}" \ https://<domainHostname>/<urlPath>Report success only when the response is.200
-
解析。
Network.Name通常与站点Network.Name不同,因此请通过URL路径前缀查询,而非猜测:DeveloperNamebashsf data query --query \ "SELECT Name FROM Network WHERE UrlPathPrefix='<urlPath>' LIMIT 1" \ --target-org <org-alias> -
使用解析后的名称发布社区:bash
sf community publish --name "<resolved-Name>" --target-org <org-alias> -
通过访问公共URL测试访客访问权限:bash
curl -sL -o /dev/null -w "%{http_code}" \ https://<domainHostname>/<urlPath>仅当响应为时报告成功。200
Phase 6 — Manual Fallback
阶段6 —— 手动回退
-
If any automated step fails (bundle undetectable, patch write blocked, deploy fails, publish fails, or guest URL not), print the Experience Builder deep link and verbatim instructions from
200. Do not claim the widget is live until the user confirms.references/manual_fallback.mdThe deep link is:texthttps://<MyDomain>.lightning.force.com/sfsites/picasso/core/config/commeditor.apexp?...networkId=<Network.Id>Resolvevia<MyDomain>andsf org display --target-org <org-alias>via:<Network.Id>bashsf data query --query \ "SELECT Id FROM Network WHERE UrlPathPrefix='<urlPath>' LIMIT 1" \ --target-org <org-alias>Do not hardcode either value. Instruct the user to open Experience Builder, drag the Embedded Messaging component onto the target page, pick the deployment from the property panel, and click Publish.
-
若任何自动化步骤失败(包无法检测、修补写入被阻止、部署失败、发布失败或访客URL未返回),打印Experience Builder深度链接及
200中的完整说明。除非用户确认,否则请勿声称组件已上线。references/manual_fallback.md深度链接格式如下:texthttps://<MyDomain>.lightning.force.com/sfsites/picasso/core/config/commeditor.apexp?...networkId=<Network.Id>通过解析sf org display --target-org <org-alias>,通过以下命令解析<MyDomain>:<Network.Id>bashsf data query --query \ "SELECT Id FROM Network WHERE UrlPathPrefix='<urlPath>' LIMIT 1" \ --target-org <org-alias>请勿硬编码任何值。指导用户打开Experience Builder,将Embedded Messaging组件拖到目标页面,在属性面板中选择部署,然后点击发布。
Rules / Constraints
规则/约束
| Constraint | Rationale |
|---|---|
| Detect bundle type from retrieval output, do not assume | LWR and Aura sites need different files patched with different key names |
Preserve the existing component | Ensures idempotency; the Experience runtime keys off |
Every new | Duplicate IDs corrupt the layout and can fail render |
LWR uses | Wrong key names silently drop the component from render |
LWR | The Experience CMS serializer expects a string |
Aura sibling | Deploy is rejected without it |
| Poll the async deploy; do not fire-and-forget | Publish must run only after deploy succeeds |
Resolve | The two are frequently different |
Do not claim "live on the site" until the guest URL returns | Publish is asynchronous; premature success reports mislead |
Never hardcode | Values are org-specific and must be queried |
| Idempotency: re-running with new ESD coordinates must update in place | Users iterate on |
| 约束 | 理由 |
|---|---|
| 从检索输出检测包类型,不做假设 | LWR和Aura站点需要修补不同的文件,且使用不同的键名 |
更新时保留现有组件的 | 确保幂等性;Experience运行时依赖 |
每个新 | 重复ID会破坏布局并可能导致渲染失败 |
LWR使用 | 错误的键名会导致组件被静默排除在渲染之外 |
LWR的 | Experience CMS序列化程序要求为字符串格式 |
Aura的同级 | 缺少该文件会导致部署被拒绝 |
| 轮询异步部署,不采用“触发即遗忘”方式 | 必须在部署成功后再执行发布步骤 |
通过 | 两者通常不同 |
仅当访客URL返回 | 发布是异步操作;过早报告成功会产生误导 |
手动回退链接中切勿硬编码 | 这些值为组织特定值,必须通过查询获取 |
| 幂等性:使用新ESD坐标重新运行必须就地更新 | 用户在设置过程中会迭代 |
Gotchas
常见问题
| Issue | Resolution |
|---|---|
| Scaffold the missing route+view pair per |
| Aura deploy rejected with missing site metadata | Copy the sibling |
| Component appended but not rendering | Confirm the region wrapper uses the correct |
| The |
Guest URL returns | Publish is async — retry the smoke test after 60s before falling back to manual |
| Re-run adds a second messaging component | The recursive search matched on the wrong key name; component detection must use |
| Deploy succeeds but widget does not appear | The messaging component is present in a region that is not on the site's home page — patch |
| Serialize it as a JSON string; the CMS parser will not accept an object |
| 问题 | 解决方案 |
|---|---|
LWR部署期间提示 | 根据 |
| Aura部署因缺少站点元数据被拒绝 | 从检索目录复制同级的 |
| 组件已附加但未渲染 | 确认区域包装器使用正确的 |
| |
发布后访客URL返回 | 发布是异步操作——回退到手动操作前,等待60秒后重试冒烟测试 |
| 重新运行后添加了第二个消息组件 | 递归搜索匹配了错误的键名;组件检测必须使用 |
| 部署成功但组件未显示 | 消息组件位于站点主页以外的区域——修补 |
| 将其序列化为JSON字符串;CMS解析器不接受对象格式 |
Verification Checklist
验证清单
Bundle Detection
包检测
- Was exactly one of (LWR) or
sfdc_cms__view/home/content.json(Aura) found?views/homeGuestLayout.json - If neither was found, did the workflow route to the manual fallback?
- 是否仅找到(LWR)或
sfdc_cms__view/home/content.json(Aura)中的一个?views/homeGuestLayout.json - 若两者均未找到,工作流是否跳转到手动回退?
Patch Correctness
修补正确性
- For LWR, are the messaging component's keys and
definition?attributes - For Aura, are the keys and
componentName?componentAttributes - When updating in place, was the existing preserved?
id - When appending, are all new values fresh UUIDs?
id - For LWR, is a JSON string (not a nested object)?
sectionConfig - For LWR, do the UUIDs referenced inside match the section
sectionConfigand child regionid?id
- 对于LWR,消息组件的键是否为和
definition?attributes - 对于Aura,键是否为和
componentName?componentAttributes - 更新时是否保留了现有?
id - 附加时,所有新是否为全新的UUID?
id - 对于LWR,是否为JSON字符串(而非嵌套对象)?
sectionConfig - 对于LWR,中引用的UUID是否与区域
sectionConfig和子区域id匹配?id
Deploy
部署
- For Aura, was copied alongside the bundle?
<siteName>.site-meta.xml - Was the async deploy polled until a terminal status?
- Is the terminal status or
Succeededbefore proceeding to publish?SucceededPartial
- 对于Aura,是否将与包一同复制?
<siteName>.site-meta.xml - 是否轮询异步部署直至终端状态?
- 在执行发布前,终端状态是否为或
Succeeded?SucceededPartial
Publish
发布
- Was resolved via
Network.Name, not reused from siteUrlPathPrefix?DeveloperName - Did complete without error?
sf community publish
- 是否通过解析
UrlPathPrefix,而非重复使用站点Network.Name?DeveloperName - 是否无错误完成?
sf community publish
Verify
验证
- Did the guest URL curl return ?
200 - Did the workflow refrain from claiming success until was observed or the user confirmed manual publish?
200
- 访客URL的curl请求是否返回?
200 - 工作流是否在观察到或用户确认手动发布后才声称成功?
200
Output Expectations
输出预期
Deliverables:
- Modified home-page JSON in the retrieval directory and in
force-app/main/default/... - (LWR only, if needed) new +
sfdc_cms__route/<RouteApiName>/pair for any scaffolded missing routesfdc_cms__view/<viewId>/ - Deploy and the final deploy report
job-id - Publish confirmation
- Guest URL smoke-test HTTP status
- On failure: the Experience Builder deep link and manual instructions
Do not produce the or the metadata — those are the responsibilities of the deployment and channel skills below.
EmbeddedServiceConfigMessagingChannel交付成果:
- 检索目录和中已修改的主页JSON
force-app/main/default/... - (仅LWR,若需要)为任何搭建的缺失路由新增的+
sfdc_cms__route/<RouteApiName>/对sfdc_cms__view/<viewId>/ - 部署和最终部署报告
job-id - 发布确认
- 访客URL冒烟测试的HTTP状态
- 失败时:Experience Builder深度链接和手动操作说明
请勿生成或元数据——这些属于下方部署和渠道技能的职责。
EmbeddedServiceConfigMessagingChannelCross-Skill Integration
跨技能集成
| Need | Delegate to |
|---|---|
| Create or update the Embedded Service Deployment | |
| Create the underlying MIAW messaging channel | |
| Create the Experience Cloud LWR site itself | |
Scaffold a missing LWR route + view pair (e.g. | |
| 需求 | 委托给 |
|---|---|
| 创建或更新嵌入式服务部署 | |
| 创建底层MIAW消息渠道 | |
| 创建Experience Cloud LWR站点本身 | |
搭建缺失的LWR路由+视图对(如 | |
Reference File Index
参考文件索引
| File | When to read |
|---|---|
| Phase 1 — LWR vs Aura retrieval and disambiguation |
| Phase 2 — delegation pointer for scaffolding missing LWR template routes (owned by |
| Phase 2 — what |
| Phase 3 — what |
| Phases 4–5 — staging into |
| Phase 6 — Experience Builder deep link and manual drag-drop-publish instructions |
| Phase 1 — deterministic LWR/Aura/UNKNOWN detection over a retrieved bundle |
| Phase 2 — idempotent LWR |
| Phase 3 — idempotent Aura |
| 文件 | 阅读时机 |
|---|---|
| 阶段1 —— LWR与Aura的检索和区分 |
| 阶段2 —— 搭建缺失LWR模板路由的委托指引(由 |
| 阶段2 —— |
| 阶段3 —— |
| 阶段4-5 —— 暂存到 |
| 阶段6 —— Experience Builder深度链接及手动拖放发布说明 |
| 阶段1 —— 对检索到的包进行确定性LWR/Aura/UNKNOWN检测 |
| 阶段2 —— 幂等性修补LWR |
| 阶段3 —— 幂等性修补Aura |