Getting Only New Customers via API


#1

Hello;
We are syncing the HS database with an offline database via the API. We are using the recently updated api. Which works ok - except:

1.) I cannot filter for just new customers. I need to get all customers with a recent createdate or lastmodifieddate.
2.) The problem with that is that the lastmodifieddate - as far as I can tell - updates under many circumstances. The most common one seems to be upon the receipt of an email. So in a given day there may be 80,000 to 100,000 total “updates” that I have to sort through to get any new customers.
3) We also with to identify anybody that’s modified their contact data - such as name or address,e tc. Is there a way to filter for customer-generated modifications as opposed to analytic stuff? Even if the email sent/delivered could be separated from this field.

I am trying as best as I can to not have to pull down tens of thousands of records…

I have seen some suggestions on doing this by creating a list. But I’d rather be able to use the customer object and API only if possible.

I guess any best practice recommendations here would help.


#2

Hi @mcmillansp

If you’re just looking for new contact records, you can use the endpoint to find recently create records:
https://api.hubapi.com/contacts/v1/lists/all/contacts/recent?hapikey=

You would page through the responses from that endpoint just like you’re page through the recently updated endpoint:
http://developers.hubspot.com/docs/faq/how-do-i-use-vidoffset-and-timeoffset

If you’re looking for recently created and updated records, you’d need to use this endpoint:

There isn’t a way to filter the returned records based on what specifically updated, but you can use &propertyMode=value_and_history in the request URL to include the history of the properties, which will tell you when the properties were updated, and what made the update (so you could check for a property being updated by HubSpot’s EMAIL or ANALYTICS processing, or whether the update came from a FORM).

You may also want to take a look at using Webhooks, since that would allow you to subscribe to contact creation, as well as subscribing to property changes for specific properties, so you could subscribe to the specific properties that you’d actually care about.


#3

Thanks. The recently created records endpoint works well. Question - does this return 30 days the same as recently updated?

Also - for webhook - we are sending data via webhook on form submission. I do not see a “contact created” event. Do I filter on “Became Customer” or “Became Lead”? I want to make sure I get all new contacts regardless of source (uploads, form submissions, manual submissions, etc.).


#4

If you’re using webhooks in workflows, we don’t have a trigger for a contact being created, but you can have the workflow trigger based on the email property. If you use the criteria contact property email is known, any new contacts will trigger the workflow (since email is required to create a contact), just make sure you set the workflow settings so that the workflow can only be triggered once.