Outbound messages nowadays is a rather out-dated technique and belongs more to the dinosaurs of Click-Integrations. However, there are still some unique scenarios where they might be more applicable than e.g. Platform Events. While both send data without really requiring a follow-up, Outbound messages do require an Acknowledgement.
That part is exactly what this article is about. When Salesforce doesn’t receive the exact Acknowledgement message, it will continue to send the Outbound message, following a retry-mechanism. And that is exactly something Platform Events do not provide out-of-the-box.
To mitigate receiving the same outbound message several times, it is crucial to send the Acknowledge when the message is received. Such Acknowledgement is send in SOAP-XML structure, as below:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <notificationsResponse xmlns="http://soap.sforce.com/2005/09/outbound"> <Ack>true</Ack> </notificationsResponse> </soapenv:Body> </soapenv:Envelope>
Duplicating requests
Next, it is important to know, Salesforce is not very keen on tightening their end. Documentation specifies it might occur that one message is send multiple times, even when Acknowledgement was received, or not send at all within 24 hours. Therefore, it is highly recommended to keep track of e.g. the NotificationIDs retrieved in the last 60 minutes on the listening party. This will prevent duplicated processing.
The NotificationID can be found in the Outbound Message Request as can be found below (e.g. 04l0800002nrC5BAAU).
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <notifications xmlns="http://soap.sforce.com/2005/09/outbound"> <OrganizationId>00D24xxx</OrganizationId> <ActionId>04k08000000wk2TAAQ</ActionId> <SessionId xsi:nil="true"/> <EnterpriseUrl>https://xxx.my.salesforce.com/services/Soap/c/50.0/00D24xxx</EnterpriseUrl> <PartnerUrl>https://xxx.my.salesforce.com/services/Soap/u/50.0/00D24xxx</PartnerUrl> <Notification> <Id>04l0800002nrC5BAAU</Id> <sObject xsi:type="sf:Opportunity" xmlns:sf="urn:sobject.enterprise.soap.sforce.com"> <sf:Id>006240000027jrVAAQ</sf:Id> <sf:Amount>60000.0</sf:Amount> <sf:CreatedDate>2014-11-26T14:45:52.000Z</sf:CreatedDate> <sf:IsClosed>false</sf:IsClosed> <sf:IsPrivate>false</sf:IsPrivate> <sf:IsWon>false</sf:IsWon> <sf:Name>GenePoint Lab Generators</sf:Name> <sf:StageName>Id. Decision Makers</sf:StageName> <sf:Type>Existing Customer - Upgrade</sf:Type> </sObject> </Notification> </notifications> </soapenv:Body> </soapenv:Envelope>