Answered

How to get the current user details in order to prepopulate forms

  • 13 September 2021
  • 4 replies
  • 374 views

Hi everyone,

I have a WordPress website and have recently added intercom. The website itself doesn't have a function (or market need) to log users in, but I'd still like to remember and prefill their details across the website once they've entered their details once before (in the chat app, or website forms).

For example​, I have a quote form and if Intercom has the name and email stored I would like it to be pre-populated into the form (and vice versa).

My question is, how can I achieve this? Intercom doesn't appear to have a JS method to get the current user details.

Thanks in advance!

Sam.​

icon

Best answer by Roy 20 September 2021, 02:31

View original

4 replies

Userlevel 1

Hey @roy s11​, you're particularly skilled in getting Intercom to integrate with different platforms, might you be able to help @sam k​ here?

Userlevel 1
Badge

Hello @sam k​ ,

 

@eric f11​ - Thanks for mentioning 🙏

 

To send Intercom data about form submission you can do it via Javascript API:

https://developers.intercom.com/installing-intercom/docs/intercom-javascript#section-intercomboot-intercomsettings/p>

 

To get data from Intercom, you can use GetVisitorID via Javascript API:

https://developers.intercom.com/installing-intercom/docs/intercom-javascript#section-intercomgetvisitorid/p>

 

Then with the following ID, you can pass website customer information via Intercom API.

 

I hope this will be helpful, let me know if you have any additional questions on this topic.

 

Best,

Roy

Thank you so much for your responses @eric f11​ and @roy s11​.

 

Roy, your answer has been helpful and I will try both both of your recommendations. Hopefully it works as planned.

 

Cheers!

Sam.

@Roy this method doesn’t appear (link is broken).  Can you please update your answer?  Looking for the same.  I also would like to know how to retrieve the user infor using js method, ie, pull their email address.  I only see a method as GetVisitorId, but nothing returned other than the internal ID, and doesnt work (undefined) for logged in users.  I need this to be able to track our tool updating email addresses in. intercom, so we log when a user of a certain user_id, is identified in the JS methods we deploy with a different email address (tracking changed to that email address for a user_id in intercom).

Finally, if we were to send info like email address using visitor id, doesnt that turn them into an authenticated user?  Only method for that is update, or install?  I think the question is how to add data to Intercom without loggin them in.  Making them leads?

Thanks.

Reply