intercom / intercom-node

Node.js bindings for the Intercom API
https://developers.intercom.com
Other
366 stars 116 forks source link

Update contact by email #361

Closed MortezaHeydari97 closed 1 year ago

MortezaHeydari97 commented 1 year ago

Why?

In some cases (that even myself have experienced), it is not possible to access the contact's id and it is only possible way to update the information of that contact by using the contact's email that is in the database. For this reason, I wrote a simple method to update contact to make an easier way for developers that experienced so.

How?

Using the search method, first I'll finding the contact's id (if exists), and then with the contact's id, you can easily update the contact using the update method.

Thanks for reviewing my pull request 😊🙏

colmdoyle commented 1 year ago

Hey @MortezaHeydari97 - First off, I'm embarrassed at how long you've had to wait for feedback on this PR, so for that I apologise!

Anyway, onto the substance. I do have some concerns with this approach. First off, email isn't a unique value in the Contact object, so I'm wary of relying on it for a potentially destructive action like an update. What behaviour would you expect if the contacts.search() code returned >1 response?

I am trying to think if there's a way to implement the spirit of the PR, which I do like.

colmdoyle commented 1 year ago

I'm going to close this PR for now, but I'll start considering how we can integrate the spirit of it into a future release.