I’m trying to import a large number of email contacts into Hubspot using their API. Right now I’m using a loop to add each contact one by one. But it’s taking too long and I’m hitting the execution time limit after about 30 seconds. Is there a way to do this in bulk instead? Here’s a simplified version of what I’m currently doing:
for contact in contact_list:
contact_data = {
'email': contact['email'],
'name': contact['full_name']
}
hubspot_client = HubspotClient(api_key)
hubspot_client.create_contact(contact_data)
contact_id = hubspot_client.get_contact_id(contact['email'])
hubspot_client.add_to_list(contact_id, target_list_id)
Any suggestions on how to make this more efficient? Thanks!