An agent's console must show live warnings when a customer's payment fails in the billing system. Design it.
Your confidence:Not rated
Model answer
Pattern: UI update based on data changes.
- Billing emits a payment failed event (or webhook) to middleware.
- Middleware maps the billing customer to the Salesforce account (external ID) and publishes
Payment_Failed__ethrough the Pub/Sub API (or REST). - A platform event trigger (or flow) in Salesforce persists a Payment Alert record on the account, so the warning survives page reloads and appears in reports.
- An LWC on the console subscribes with
lightning/empApiand shows a banner immediately if the agent has that customer open; it also reads open alerts on load. - Security: the event carries no sensitive card data; the integration user can publish only that event.
- Resilience: replay IDs in middleware for retries; if real-time delivery fails, the persisted alert still appears on the next load.
โ Key points to hit
โ Red-flag answers
- Polling the billing API every few seconds from the browser
- Showing alerts only via events, so they vanish on reload
โช Follow-ups
Why persist the alert as well as publishing the event?
Events are transient and only reach subscribers connected at the time. A record gives history, reporting, and a reliable display when the agent opens the customer later.
How many users can subscribe to events in LWC?
There are allocations for event delivery to CometD/empApi clients; for large contact centres, check the allocation and keep event payloads small โ verify current limits.