Lists v3 in Workflow custom code

Hkrewson
Participant

Greetings. I have a custom object workflow that will enroll on a property being known. My end goal with the workflow is to use an email property on the custom object, locate a contact, and add that contact to a static list.  

 

My code (python 3.9) works for the search, and can return the ID just fine. When I add an import for the v3 lists endpoint 

from hubspot.crm.lists import MembershipChangeRequest, ApiException

I receive the following lambda_warning.

Unable to import module 'hubspotHandler': cannot import name 'lists' from 'hubspot.crm' (/opt/python/hubspot/crm/__init__.py)

The private app in use has the scopes for crm.lists.read and crm.lists.write. Is this just not implimented in workflow custom code.

0 Upvotes
1 Accepted solution
SteveHTM
Solution
Key Advisor

@Hkrewson - when I ran up against such version issues (likely cause for a new API) with HubSpot libraries in the past, I simply dropped down to the use of Python requests() functionality, constructing the URLs using basic code. I haven't looked back since then, and do all my work at this basic call/response level. It also turns out to be easier to debug in many instances with fewer layers to interpret.

response = requests.request("GET", propery_query_url, headers=headers)

 

Best of luck!

 

Steve

 

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature

View solution in original post

0 Upvotes
1 Reply 1
SteveHTM
Solution
Key Advisor

@Hkrewson - when I ran up against such version issues (likely cause for a new API) with HubSpot libraries in the past, I simply dropped down to the use of Python requests() functionality, constructing the URLs using basic code. I haven't looked back since then, and do all my work at this basic call/response level. It also turns out to be easier to debug in many instances with fewer layers to interpret.

response = requests.request("GET", propery_query_url, headers=headers)

 

Best of luck!

 

Steve

 

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes