Outbound message Salesforce and n8n

I wanted to share what I learned when connecting Salesforce with and outbound message to n8n. When you create an outbound message in Salesforce, for example triggered by a flow, Salesforce will send an XML SOAP message to the Webhook in n8n. You can use this data in n8n without problem. The problem is that Salesforce needs an acknowledgement of the send message, otherwise it will send it again and again. To send the right acknowledgement you have to configure n8n like this:

5 Likes

Thank you so much for sharing @timautomation! I love such bits of information about services, especially when they aren’t self-explanatory :slight_smile:

Hi,
New to N8N. I’m trying to set up Salesforce webhook trigger in my workflow and
am facing an issue while trying to get updated accounts data from my Salesforce. Currently, the webhook is only triggering my workflow for newly created accounts on Salesforce and not triggering for any updates/edits.

I created a webhook on Salesforce with Test URL and executing the workflow manually. I also added Respond node “ACK Response to SF” like above.

What could be causing this? Any additional setting required to trigger the workflow for updates?
Screen Shot 2023-04-21 at 9.26.02 AM

Thank you!

Hi Lakshmi,
I think there is nothing wrong with your n8n flow but the trigger in Salesforce. My best guess it that you have to change the setting in your salesforce flow from ‘A record is created’ to ‘A record is created or updated’. Then the outbound message is triggered and then the n8n webhook is triggered

Change to created or updated
image

2 Likes

Thank you so much for your prompt response!

I’ve configured my setting as above but I selected “None” in the Set Entry Conditions. Do I need to set a condition to trigger for updates?

Here is my settings screenshot:

Thanks,
Lakshmi

Cleared outbound messages in the Salesforce and it started working.

Thank you!

2 Likes

Hello! I am currently experiencing issues with Tunnel URL.

I am running n8n on Docker and using a production webhook tunnel URL to trigger my workflow. Initially, my workflow triggers without any problems when I start n8n. However, after some time has passed, or if I edit my workflow, the webhook fails to trigger and I see “504 Gateway Time-out” error. This is causing outbound messages in Salesforce to fail.

To resolve this issue, I have to clear my outbound messages, restart n8n to generate a new tunnel URL, which allows the webhook to work again. Do you have any advice on how to fix this issue?

Here is my outbound messages screenshot:

Hi @Lakshmi, the tunnel URL is not intended for production usage. It is not a permanent URL and has no uptime guarantee. So it’s perfectly fine for a quick test, but you really shouldn’t use it for anything important.

Also, keep in mind this thread in which @timautomation is sharing a tip on how to handle Salesforce SOAP messages in n8n. If you have any questions on how to actually set up n8n you would want to open a new thread in the question category. But to give you an idea of the available options:

  • The most straightforward way of getting a permanent URL would be using n8n cloud.
  • A cheaper way to get a permanent domain would for example be this one.
  • The most common (but also slightly more complicated) way on production servers would be to put a reverse proxy server in front of your n8n instance which receives all HTTP/HTTPS requests and passes them on to n8n (or other applications) as needed.
1 Like

I understand, thank you!

1 Like

Hello everyone, after add the solution that @timautomation provided, I started to receive logs in n8n.
But actually something doesn’t look good on Salesforce side, cause the " Outbound Messages" doesn’t look linked to any flows, and I the “Outbound Messaging Delivery Status” return me this error:

Delivery Failure Reason
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

Hi Gabriele_Bracciali,
I do not understand enough of the context around your setup to help you right away, but if you could provide a little bit more context, I can try :slight_smile:

Does the n8n flow run or not even if SF is giving you the error?

  • If it does not run the problem is likely due the a problem in the setup of outbound message and the flow/connecting the SF outboundmessage/flow to the n8n webhook.
  • If it runs the setup in salesforce is probably correct. Possibly the n8n node response to webhook is incorrect, did check all the settings and fields in your flow compared to the nodes above?

Hi @timautomation , thanks for replying me.
I’ve setted up the Outbound message and the flow in Salesforce, and without the “ACK Response to Sf” I wasn’t even getting logs in n8n. And the “Outbound Messaging Delivery Status” return me 404.
After adding the node, I can receive the log in n8n, but looks like that Salesforce can’t reconieze it and so it try several attempt.

So if I understand you correctly

  • without the node “ACK response to SF” n8n flow does not run
  • With the node “ACK response to SF” n8n flow runs but SF outbound messages is giving errors

I think that is a little bit weird, n8n flow should also run when this node does not exist, it will only cause salesforce to keep tying to send the outbound message because it thinks n8n did not receive it but it actually is received, so please check again and remove the ACK node for a test run. This should work.

But again: did you check all the settings and fields in your flow compared to the nodes above? or try to copy and paste the nodes above in your n8n flow. So you are sure the right settings are configured, it should be an exact copy except of the webhook url that is specific.

Oh and lets use the same terms: logs = run: right?

Hi @timautomation,
I’ve switched from the cloud version to the Self-hosted version of n8n.
And If I use the self-hosted version link it return me a 403 error, but with the cloud version it’s working

Hi Gabriele_Bracciali,

Good to know :slight_smile: Also good to know is that I posted an other way of connecting Salesforce to start n8n workflow. I this this way (HTTP callout) is safer and more future proof than the outbound message. See this article Start n8n workflow from Salesforce flow with HTTP Callout - Built with n8n - n8n

Hi @timautomation , I hope you are doing well.
I have connected the cloud version to salesforce account.
I’ve created a Flow with a Lead creation trigger then send the webhook to n8n.
The workflow it’s working, so the trigger is listening and send the lead to n8n without errors.
BUT on the “Outbound Messaging Delivery Status” page I have several items next to delivery with this error:
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

Do you have an idea?

Is the webhook itself set to

Is the content of the response webhook correct? You can copy past the node from the first post.

Otherwise you can use this (better) connection See this article Start n8n workflow from Salesforce flow with HTTP Callout - Built with n8n - n8n

2 Likes

ahh yes, now I see, I forgot to edit the “Response mode”.
Thank you, now should work!

2 Likes