Salesforce credentials creation using n8n API

Is is possible to create automatically (using n8n API) credentials for Salesforce for particular Salesforce app (diffrents clients) and us it in defined before workflow which use Salesforce app data - for example for creating Leads in Salesforce app?
I want to have scenario like this:

  • I have Salesforce workflow for lead creation

  • my client add Salesforce app data for such workflow and can trigger such workflow

  • client have access only to my system (which use n8n API)
    Many thanks for the info!

  • n8n version: ANY

  • Database (default: SQLite): default

  • n8n EXECUTIONS_PROCESS setting (default: own, main): own

  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm

  • Operating system: Linux

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:

Hey @Dawid_wie,

Welcome to the community :tada:

You can use the n8n api to add credentials to n8n but there isn’t a way to dynamically select the credential to use in a workflow so you would need multiple worklfows and have one for each client. It may also be worth noting that if you are using n8n for multiple clients to access something like Salesforce you may require an embed or enterprise license so it could be worth getting in touch with our license team to find out they may also be able to help work out a better way to achieve what you are trying to do.

1 Like

@Jon Thank you very much for the answer!
But let me know if possible is such situation:
I’ve defined one simple workflow for Salesforse lead creation (for one test client) - this is my model workflow (only for knowing what components I want to use).

In my system I would have opportunity for my clients to use such workflow in that way that they can create copy of such workflow and use it.
So is it possible to create dynamically all steps for such workflow? Especially the credentials part for Salesforce? If its possible could you give me any example of Credential creation for Salesforce (As I understand I need Enterprice licence when I want to have many Credentials for Salesforce).
Thank you for any helpful information!

Hey @Dawid_wie,

So one thing you could do is maybe create the credential with the API then after it is made use the API to fetch the json of a template workflow and update the credential in the JSON data before using it to create a new workflow.

I sadly don’t have an example on how to do this so there will be a bit of work involved but our API is fairly well documented. The only but that will cause an issue is you will need the user to authenticate with salesforce if using OAuth so your application would need to handle that and pass all of the oauth fields to n8n, Because of this it may be easier to give the user access to n8n iteself and use credential overwrites so they just have a button to press to authenticate from inside n8n then you could kick off the workflow copy process using a hook.

1 Like