Invoice Ninja - Prevent duplicate Clients

Describe the problem/error/question

I just setup n8n and Invoice Ninja on unraid.

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

Invoice Ninja Version v5.10.29

I am trying to setup LDAP authentication/client creation for Invoice Ninja using OpenLDAP.
In n8n I’m able to get the proper LDAP search for the users in the Invoice Ninja group I have in OpenLDAP.

After that, the flow goes to “Invoice ninja Create: client” and the 8 users I have are created.

The Issue:
If I add a new user to my OpenLDAP group for Invoice Ninja, I run the flow again, but it creates duplicates of the 8 users/clients that were already added.

I’ve tried Remove Duplicates but either I’m not understanding how that works, or its not working.

Essentially I want the whole flow to run every 15 or so minutes, check if the user is already in Invoice Ninja as a client, if it is, ignore it and move on to next user, if a new user is in the OpenLDAP group, create the new client in Invoice Ninja.

I’m just trying to avoid having duplicate clients every time the flow runs.

I don’t want to create clients in Invoice Ninja then send them to OpenLDAP. I start the whole new user creation in the frontend of my OpenLDAP server.

Thanks for any.

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:

Welcome to the community @zer0ish !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.


It sounds like you would need to check the existing Ninja users before adding new one. Your workflow does not seem to do that. If it is omitted from your “demo”, could you show how your try to “de-duplicate”. In my mind you simply check if the user already exist and create him if not. Sounds simple unless I misunderstand the problem.

Correct, I’m trying to figure out how to build the flow so it checks before creating new users. I’m comfortable with LDAP and if it was built in natively into Invoice Ninja I would have been done within minutes :frowning:

Any chance you can help me build the flow to achieve what I’m looking for?

LDAP user list > check for new users in proper group every x minutes > found new user? > create new user in Invoice Ninja.

I’m very new to n8n, I just installed it today. So making flows doesn’t come naturally to me.

I’ll keep trying but help on getting the proper flow would be appreciated.

Thanks.

Wow, I guess being persistent is good thing.

So now my flow more or less works.
LDAP has 9 users. Invoice Ninja has 8 clients.
Invoice Ninja “getall clients” makes a bunch of extras. Fed that into remove duplicates and it left me with 8 clients in Invoice Ninja.

The compare flow compares both, and then if it’s different creates the missing clients.

This is a good start. Ill keep tinkering. Now I have to figure out why the users password doesn’t seem to work on Invoice Ninja client portal.

EDIT: Invoice Ninja clients dont have a password until they use the Forgot your password? option. This is something Ill have to bring up to Invoice Ninja for the LDAP to properly work.

1 Like

Sounds like the right approach.

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