<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Process to sync contacts to the contacts APIv3? in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Process-to-sync-contacts-to-the-contacts-APIv3/m-p/689925#M56682</link>
    <description>&lt;P&gt;So you are trying to push your contacts database into HubSpot? Is this event driven on your end (when one contact is created externally you created that in HubSpot) or is your side batch as well (every so often you grab your new contacts and batch load them into HubSpot).&lt;BR /&gt;&lt;BR /&gt;And is what you are working on now like an initial import of contacts, or what will the ongoing integration piece look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ask because depending on what you are doing I might do different things. If I were building an event driven integration where each time my local database adds a contact I want to make sure it gets into HubSpot, I would use the &lt;A href="https://developers.hubspot.com/docs/api/crm/search" target="_blank" rel="noopener"&gt;search API&lt;/A&gt;&amp;nbsp;to search on two properties: email, and hs_additional_emails. I would search using two different filter groups so it'll match on either one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I get a match, I would then store the HubSpot ID in my database with that record so I never need to check that contact again and I know it's associated HubSpot record ID if I ever need it. If I don't get a match, then I would create a contact in HubSpot. Depending on the pace at which new records get added to your database, an event driven integration like this might work just fine never hitting limits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to do it in batches, you could search using IN instead of EQ and use more than one input email at once. You'd have to cap it at 10K since that is the max for the endpoint and each page of results is max 100, so consider that. But after you pull them down you can match the results against your local data, queue up the missing ones and then batch create them at the end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are probably other ways too but a lot depends on if you want to work in batches or event driven, how much data you are working with, and what you want your integration to look like.&lt;/P&gt;
&lt;P&gt;&lt;INPUT id="hippowiz-ass-injected" type="hidden" value="true" /&gt;&lt;INPUT id="hvmessage-toextension-listener" type="hidden" value="none" /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2022 18:15:15 GMT</pubDate>
    <dc:creator>LeeBartelme</dc:creator>
    <dc:date>2022-09-06T18:15:15Z</dc:date>
    <item>
      <title>Process to sync contacts to the contacts APIv3?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Process-to-sync-contacts-to-the-contacts-APIv3/m-p/689607#M56648</link>
      <description>&lt;P&gt;I am in the process of writing an HS integration solution for our customer database. However, I have not been able to figure out how to properly sync contacts through the API. This is what I am doing:&lt;/P&gt;&lt;P&gt;- Get a list of all contacts from HubSpot&lt;/P&gt;&lt;P&gt;- Check contacts in the database if there is one with the same email address&lt;/P&gt;&lt;P&gt;- If no, add contact to HubSpot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To save on traffic I do as recommended by HubSpot and I use the batch API. It took a while for me to learn that there is a secondary email address that I have to check as well, so I included secondary_email in the list of fields I would like to receive from the contacts API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I just ran into the problem that obviously HubSpot does not only allow one or two email addresses per contact but an infinite list of email addresses which I am supposed to check before importing a new contact.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, there does not seem to be a way to retrieve all email addresses for a contact in the batch API. So my question is, what am I supposed to do? There is an API to download all email addresses for a given contact, but that just does not make sense at all?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Download all contacts using the batch API&lt;/P&gt;&lt;P&gt;- Download a list of email addresses for every single contact&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That defeats the purpose of using a batch API, that's tons of useless API calls which slow down the whole process and makes one hit the rate limit even quicker.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apart from that, I also use the batch API to add contacts. If the batch contains just one contact that throws an error, the whole batch will fail. So I can't just log single contacts that failed but whole batches of 10. Wouldn't it be much easier if the API returned those contacts that were added successfully and those that threw exceptions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is it I don't see here?!? How is that process supposed to look like? What would be a proper implementation?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 07:52:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Process-to-sync-contacts-to-the-contacts-APIv3/m-p/689607#M56648</guid>
      <dc:creator>Aileron</dc:creator>
      <dc:date>2022-09-06T07:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Process to sync contacts to the contacts APIv3?</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Process-to-sync-contacts-to-the-contacts-APIv3/m-p/689925#M56682</link>
      <description>&lt;P&gt;So you are trying to push your contacts database into HubSpot? Is this event driven on your end (when one contact is created externally you created that in HubSpot) or is your side batch as well (every so often you grab your new contacts and batch load them into HubSpot).&lt;BR /&gt;&lt;BR /&gt;And is what you are working on now like an initial import of contacts, or what will the ongoing integration piece look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ask because depending on what you are doing I might do different things. If I were building an event driven integration where each time my local database adds a contact I want to make sure it gets into HubSpot, I would use the &lt;A href="https://developers.hubspot.com/docs/api/crm/search" target="_blank" rel="noopener"&gt;search API&lt;/A&gt;&amp;nbsp;to search on two properties: email, and hs_additional_emails. I would search using two different filter groups so it'll match on either one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I get a match, I would then store the HubSpot ID in my database with that record so I never need to check that contact again and I know it's associated HubSpot record ID if I ever need it. If I don't get a match, then I would create a contact in HubSpot. Depending on the pace at which new records get added to your database, an event driven integration like this might work just fine never hitting limits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to do it in batches, you could search using IN instead of EQ and use more than one input email at once. You'd have to cap it at 10K since that is the max for the endpoint and each page of results is max 100, so consider that. But after you pull them down you can match the results against your local data, queue up the missing ones and then batch create them at the end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are probably other ways too but a lot depends on if you want to work in batches or event driven, how much data you are working with, and what you want your integration to look like.&lt;/P&gt;
&lt;P&gt;&lt;INPUT id="hippowiz-ass-injected" type="hidden" value="true" /&gt;&lt;INPUT id="hvmessage-toextension-listener" type="hidden" value="none" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 18:15:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Process-to-sync-contacts-to-the-contacts-APIv3/m-p/689925#M56682</guid>
      <dc:creator>LeeBartelme</dc:creator>
      <dc:date>2022-09-06T18:15:15Z</dc:date>
    </item>
  </channel>
</rss>

