Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hubspot::Contact allow caller to pass a showListMemberships parameter #184

Closed
wants to merge 2 commits into from

Conversation

dventulieri
Copy link

Added a show_list_memberships parameter to the find_by_id, find_by_email, and find_by_utk methods in Hubspot::Contact. When sending requesting contacts by batch, the HubSpot API defaults the showListMemberships to false. Therefore, there is no way to get ContactLists for a group of emails.

This new parameter allows us to request list_membership data when requesting a batch of contacts.

@dventulieri
Copy link
Author

Looks like there is no longer any support for /contacts/v1/contact/emails/batch/, which makes this PR obsolete...

@cbisnett
Copy link
Collaborator

I'm not sure what you mean when you say there is no longer any support for the endpoint. I haven't seen anything in the documentation or changelog that would suggest Hubspot is shutting down the endpoint.

Since the documentation shows there are several options that can be passed to modify the request, I think it's better for these functions to take an optional second parameter options = {} which then gets passed in the request. This way all of the options are supported (including any that get added in the future) without needing to add a bunch of options to the method declaration.

@dventulieri
Copy link
Author

@cbisnett Sorry I meant the FIND_BY_EMAIL_PATH_BATCH path was removed from contact.rb. That's the path that is used to get batch emails. I.e. we would pass an array of email addresses and get a list of contacts back.

However, when sending a batch of emails, the showListMemberships option was set to false by default. We needed that to be set to true. So instead we were forced to call Hubspot::Conection.get_json directly:

batch_email = ["[email protected]", "[email protected]", "[email protected]"]
Hubspot::Connection.get_json(
  GET_CONTACTS_BY_EMAIL_PATH,
  { batch_email: batch_email, 
    showListMemberships: true }
)

This PR was meant to give the caller the option to pass showListMemberships: true to the find_by_email method, as to avoid calling Hubspot::Connection.get_json directly.

Now that the batch path is no longer in contact.rb, I'm not sure this PR is relevant anymore. Do we just pass in an array of emails to Hubspot::Contact.find_by_email? Also how do we specify that we want to showListMemberships: true ?

https://github.com/adimichele/hubspot-ruby/blob/master/lib/hubspot/contact.rb#L29-L32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants