# How do declarative Outbound Messages transmit event notifications to external listeners without writing Apex code?

**Topic:** Integration · **Difficulty:** Medium · **Tags:** Integration, Outbound Messages, Declarative Integration

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-declarative-outbound-messages-transmit-event-notifications-to-external-listeners-without-writing-apex

## Answer

**Basics:** It is a "push on change" mechanism: when a record meets criteria, Salesforce posts an XML message to a URL you configure. The receiver replies with an acknowledgement. Important correction: Outbound Messages belong to **Workflow Rules**. Flow has no Outbound Message action, and Workflow Rules are retired (end of support December 31, 2025; existing rules keep running, but do not build new ones). For new designs use Platform Events, Change Data Capture, or the Flow HTTP Callout action.

**How it works:**
1. Setup > Outbound Messages > New: choose object, endpoint URL, fields to send, optional "Send Session ID".
2. Attach the message as an action to a Workflow Rule (on create or update criteria).
3. After the transaction commits, Salesforce queues the message and delivers it asynchronously.
4. The listener must return a SOAP `Ack` of true.
5. If delivery fails, Salesforce retries with growing intervals for up to 24 hours, then drops it (verify the current window).
6. Monitor under Setup > Outbound Messaging Delivery Status.

**Advanced / deep dive:** The message uses a generated WSDL, includes the notification, org ID and the record sObject with chosen fields. Because delivery is retried, the same message can arrive more than once and order is not guaranteed, so the receiver must be **idempotent** (use the notification Id and record Id with timestamps). Messages are sent as the system, so the receiver should validate the source (IP ranges, mutual TLS or the session ID callback). The session ID option lets the listener call back into Salesforce, but consider the security implications. Modern replacements: Platform Events (publish from Flow or Apex, subscribe via Pub/Sub API), CDC for record changes, and Flow HTTP Callout/External Services for pushing REST payloads. These give JSON, replay (72-hour retention) and better governance.

**Code / config example:** Setup steps are the example: create Outbound Message "Order_Closed_Msg" on Order__c, select fields Id, Status__c, ERP_Id__c, endpoint `https://listener.example.com/sf`, then add it as an Immediate Action on a workflow rule with criteria `ISCHANGED(Status__c) && ISPICKVAL(Status__c,"Closed")`.

**Hidden gotchas & must-remember points:**
- Flow cannot send Outbound Messages; only Workflow Rules.
- Workflow Rules are retired, so migrate to events or HTTP callouts.
- Delivery is at-least-once, possibly out of order.
- The listener must acknowledge, otherwise Salesforce keeps retrying.
- The message is a SOAP/XML contract only.
- Only the changed record and chosen fields are sent, not related data.

**Best practice:** For anything new, prefer Platform Events or CDC; if you keep Outbound Messages, make the listener idempotent and monitor delivery status.

---
Source: ForceChallenges · last updated 2026-11-02
