blairanderson
12/16/2016 - 9:12 PM

Using Intercom API, creating a message for a given user's email.

Using Intercom API, creating a message for a given user's email.

I have a web form for user feedback, seems obvious to plug this into intercom to track messages for a given user.

Given:

  • body: Ponies, cute small horses or something more sinister?
  • from: {"type": "admin","id": "some-admin-id"}
  • to: some-email@example.com

How:

Do I get that message into intercom, without knowing the user's intercom_id or if they are a lead/contact/user?

I had a chat conversation with an intercom support rep that recommended:

  • find USER by email(1st API request), get the id
  • if no USER, find LEAD by email(2nd API request), get the ID
  • if no LEAD, create LEAD(3rd API request), use the ID
  • create message with user_id/contact_id(4th request)