Outbound Messaging

Outbound messaging uses the notifications() call to send SOAP messages over HTTP(S) to a designated endpoint when triggered by a workflow rule.

Outbound endpoints are continuously listening for the events.

What is outbound Message?

  • Is a notification() SOAP API call
  • A single SOAP message can include upto 100 notifications. Each notification contains the object ID and a reference to the associated sObject data.
  • If the response from the other party is not ok then it will try to resend the notification for all those requests which are 24 hours old.

notifications() call:

Outbound message will have following format which will contain notifications.

<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" 
 targetNamespace="http://soap.sforce.com/2005/09/outbound">
	<import namespace="urn:enterprise.soap.sforce.com" />
	<import namespace="urn:sobject.enterprise.soap.sforce.com" />

	<element name="notifications">
		<complexType> 
			<sequence> 
				<element name="OrganizationId" type="ent:ID" />
				<element name="ActionId" type="ent:ID" />
				<element name="SessionId" type="xsd:string" nillable="true" />
				<element name="EnterpriseUrl" type="xsd:string" />
				<element name="PartnerUrl" type="xsd:string" />
				<element name="Notification" maxOccurs="100" 
				  type="tns:OpportunityNotification" />
			</sequence> 
		</complexType> 
	</element>
</schema>

where ActionId is the workflow rule(action) that trigger this message.

The Notification datatype is defined in the WSDL as below-

<complexType name="OpportunityNotification">
	<sequence>
		<element name="Id" type="ent:ID" />
		<element name="sObject" type="ens:Opportunity" />
	</sequence>
</complexType>

Notification response:

Below is the schema for sending acknowledgement (ack) response to salesforce.

<element name="notificationsResponse">
	<complexType>
		<sequence>
			<element name="Ack" type="xsd:boolean" />
		</sequence>
	</complexType>
</element>

Schema should be only in this format otherwise salesforce will not consider message to be delievered.

Creating outbound message using workflow:

In this outbound message creation, we will be using rest endpoint generated from hookbin.com-

Creating Outbound Message

Demo:

Testing Outbound Messaging using Hookbin

Also, check outbound message status under Setup->Monitoring->Outbound Messages as shown below-

It is showing delivery as failed which we can ignore as of now because we are not getting response(ack) from hookbin in format described in Notification response section.

Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

Leave a Reply