Salesforce - convertLead() using REST API


I would like to convert leads in Salesforce using convertLead() which is a SOAP API call but it seems there are solutions to achieve something similar through REST.

As describe in this stackoverflow post it seems to be possible to
“construct a one-off SOAP request to convert a lead and use the same OAuth token that you already have for the REST API.”

As explained I tried to reproduce this in the node below using predefined credential type from the Salesforce Oauth2 API integration.

However I get the following error as I can’t get value for YOUR SESSION ID (line 7)

To overcome this I tried to use a generic authentification through n8n connected app but I can’t login as I get “Something went wrong” error when trying to “connect my account”. I was aiming to do so to get information related to sessionId token.

  1. Is it possible to get session_id value from OAuth2 predefined credential in order to pass it in the one-off SOAP request ?
  2. If not - how can I overcome the error from generic credential I get ? Consumer and Secret Ids are correctly setup we proper scope as above.
  3. Is someone has a better option to achieve what I’m trying to do here ?

Thanks for your help

Information on your n8n setup

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@Vincent_Bonjean , to get your session ID you need to use login API first. Here’s the curl command for that. Hopefully you can convert it into HTTP Request node configuration.

curl --location '' \
--header 'Content-Type: text/xml' \
--header 'SOAPAction: login' \
--header 'charset: UTF-8' \
--data-raw '<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd=""
    <n1:login xmlns:n1="">

The outcome of this would be XML response like this with sessionId

<?xml version="1.0" encoding="UTF-8"?>
					<currencySymbol xsi:nil="true"/>
					<orgDefaultCurrencyIsoCode xsi:nil="true"/>
					<orgDefaultCurrencyLocale xsi:nil="true"/>
					<organizationName>Snowplow Analytics Limited</organizationName>

To get it working, you might need to ensure n8n IP addresses are whitelisted in Salesforce Settings → Network Access.


thanks @ihortom !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.