Skip to main content

Hi,

 

We have the messenger installed on our website and we now need to 1) create the companies available in our product 2) associated the users to each company.

I know that both points are possible via the intercom API but I was wondering if these two steps can be achieved directly by passing the company_id and name (for 1) and some sort of link in the payload sent by the messenger like we do for the user_data:

user_data{"email":"myemail@google.com","user_id":"github|blabla","user_hash":"d5c0534625a6ec7ad75bc5b2a9f231b1febb226ff37bde15df3e6693c0130677"}

it’s probably not the most secure way but I was wondering if it’s something that can be done instead of doing all this back-end side

 

 thank you

Hi @Alessandro Carrano !

You can create a company and associate a user with it all in one go by using our Intercom installation snippet for Users. When a user logs into your app you’ll also log them into Intercom with the installation snippet. If you pass a company object over in that installation snippet with the Company ID and Name, it will create the Company in Intercom (if it’s not created yet), and associate that User with the company. NOTE: You need to make sure you include BOTH the Company’s ‘id’ attribute along with it’s ‘name’ attribute in order for this to work.

You can read up more about this in our article on the topic, here!


thanks for your answer!


Reply