Heroku - 20 Configuration Messages Outbound
This hands-on lesson configures a Salesforce Outbound Message on the Case object so that every change is sent to a Heroku application. The plan is: deploy a small receiver app on Heroku, briefly explain what its code does, create the workflow rule and the Outbound Message on Salesforce, then validate that messages flow correctly — including ACK and NACK responses.
The Heroku receiver code
The Node.js receiver loads the modules needed by the app: body-parser to read the incoming HTTP body, and body-parser-xml to detect that the body is XML and automatically convert it into a JSON-like structure (Outbound Messages from Salesforce are XML). The rest is the boilerplate to start an Express server that listens for requests. On top of that, the file defines the two responses we must return to Salesforce: ACK when the operation succeeds and NACK when it fails. Since the code itself is not the main focus, you can copy it as is if you want to reproduce the lesson.
To deploy, go to the application's Deploy tab on Heroku and follow the instructions. With the Heroku CLI already authenticated and inside the project folder, the remaining commands are:
git add .
git commit -m "outbound receiver"
git push heroku master
Configure the workflow rule and Outbound Message in Salesforce
In Salesforce Setup, open Workflow Rules and click New Rule. Pick the Case object and click Next. Give the rule a simple name; for the evaluation criteria, three options are available:
- Trigger only when a Case is created.
- Trigger when a Case is created or modified.
- The third option behaves like the second but also lets you customize additional criteria.
We pick the second option. The rule criteria section lets you filter which records actually fire the rule; for this simple demo we use Rule is true with no extra filter, save and continue. Then we add an action: New Outbound Message. We leave most things as defaults; the important field is the Endpoint URL, which is the public URL of the Heroku app (visible via Open App on the Heroku dashboard) suffixed with the route exposed by the receiver, for example /cases. We select every Case field to be included in the message and save. Finally, we activate the rule (it is inactive by default).
Test ACK / NACK and retries
We open the Heroku app's logs in one tab to watch incoming requests, then go back to Salesforce and create a new Case (filling type, status, priority "Medium" and origin "Web" for the example). Saving the Case triggers the rule, and the Heroku logs immediately show the incoming Outbound Message with all the Case fields.
To test the NACK path, we change the priority from Medium to Low. The receiver code was configured to ACK only when the priority is Low, and NACK otherwise. With the modification, the message is sent and ACK is returned, so Salesforce stops retrying. Conversely, when a message is not acknowledged, you can see Salesforce keep sending additional requests even though we did not change anything on our side — that is the retry loop in action.
To monitor failed requests in Salesforce, open Outbound Messages → Outgoing Messages. For each failed message you can see the related record ID, the number of attempts so far (for example four), the reason for the failure, the date and time of the last attempt and the scheduled next attempt. Salesforce will keep retrying for up to 24 hours; past that window, the request is dropped and not retried again. See you in the next lesson.
Summary
This lesson covers deploying a Node.js application to Heroku to receive and process outbound messages from Salesforce. You'll configure Salesforce workflow rules to trigger outbound messages on case creation or modification, set up message routing to your Heroku application URL, and implement ACK/NAK acknowledgement responses to confirm successful message delivery.
Key points
- Deploy Node.js code to Heroku using git commands to enable your application to receive and parse XML messages converted to JSON format
- Create workflow rules in Salesforce to trigger outbound messages based on case events (creation or modification)
- Configure outbound message actions with your Heroku application endpoint URL and select which case fields to include in messages
- Implement ACK (acknowledgement for success) and NAK (non-acknowledgement for failure) responses in your application code
- Activate the workflow rule in Salesforce after creation, as new rules are disabled by default
- Verify the integration by creating test cases in Salesforce and monitoring application logs to confirm messages are received
FAQ
What is the purpose of ACK and NAK responses in Salesforce outbound messages?
ACK indicates successful message processing to Salesforce, while NAK indicates the operation failed. Your application must send the appropriate response back to Salesforce so it knows whether to retry the message delivery.
How do I find the correct URL to configure for the Heroku outbound message action?
Navigate to your Heroku application's Overview page, copy the application URL, and append the correct endpoint path (such as /bands) where your application is configured to receive incoming messages.
Why are my Salesforce outbound messages not being sent even though the workflow rule is created?
Newly created workflow rules are disabled by default in Salesforce. You must explicitly activate the rule in the workflow settings for it to start triggering outbound messages.