How can I create a new user and link it to an already existing company?

Hi there!

Our company is working on a webplatform where a user can fill in a webform. After submiting, we want to create these 3 things in Freshdesk (using php api):
1) a company
2) a user (linked to that company)
3) a ticket

So far so good, but when I create a new user and the given company already exists, I get a conflict response 409 (company name has to be unique)

So in this case I would like to link the new user to the existing company. But I don't know the required company's id... (to link the user to it)

So I tried to retrieve a list of all companies existing in freshdesk and loop through all of them, to get a match and return that id. Problem is for every company retrieved an api call is performed, so (as we have a list of hundreds of companies) quickly I get to the api limit of 5000 requests per hour.

I also tried the search/filter api call, but this only works for users/tickets? The 'Domain names field' might be useful, but when a user uses for example a gmail-address instead of it's company email, every single future new gmail-address will get linked to that company unintended?

Is there any other solution for this problem, or what would be the recommended approach?

I hope there is some other way, thanks in advance!


1 person has this question
Login or Signup to post a comment