jpetrucciani/hubspot3

Pulling custom properties for Contacts

NickBrecht opened this issue ยท 5 comments

Hello,

I believe this is closely related to ticket #14. I'm trying to pull a number of fields across all contacts: vid, email, and a custom field.

Is there a way to select this within .get_all()? Or is there another way to solve for this?

Yep sounds very similar! I can push out this new addition soon - I'll add an extra_properties field to the get_all method of ContactsClient.

I ended up adding extra_properties kwargs to both get_batch and get_all of the ContactsClient.

You can take a look at the commit here if you'd like!

That should now be live on pip as version 3.1.7.

I'll close the issue for now, but feel free to reopen it if you have any issues or suggestions!

@jpetrucciani Confirming the feature does work in get_batch() and get_all().

I did notice in the code you check in the variable passed to extra_properties is a list or not. If it not a list (i.e. someone trying to just add one extra field) then the isinstance() will return false and the field not appended to the list of properties in the API call.

Maybe you had some deeper logic wanting to prevent users from messing something up, but it may be worth adding some handling for someone just wanting to add one string field and append the singular property.

Your additions to the package work perfectly for my needs and thank you for your help!

Interesting, I only added that as type enforcement, but it would be easy to extend it to allow for just a string as well!

Version 3.1.8 is now live on pip! This contains logic to accept a list of strings or a single string for extra properties. I've also added similar functionality to the Companies client with this release.