<?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: append info instead of overwriting in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/625476#M52816</link>
    <description>&lt;P&gt;Awesome! Happy I could help.&lt;/P&gt;</description>
    <pubDate>Mon, 02 May 2022 13:34:31 GMT</pubDate>
    <dc:creator>Teun</dc:creator>
    <dc:date>2022-05-02T13:34:31Z</dc:date>
    <item>
      <title>append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/623980#M52710</link>
      <description>&lt;P&gt;Hi everybody, hope everythings going well!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my situacion, Im sending lead info from my webpage to hubspot using python. the thing is, some properties doesnt need to be overwrited.&lt;/P&gt;&lt;P&gt;E.g. someone is looking product&amp;nbsp; in my website, so he sends a request and i receive it and send it to hubspot, then he goes to other option that he likes it too and sends a request with the second option and its the same as the first request, what i hoping to see in hubspot its 1 contact with a field that says tha he likes option 1 and 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Theres one las ting to get in mind, not all properties gonna be appended, in the above case, i need that email, phone, cityt, etc be overwritted in each request&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some doc that i can look for, or theres somethin im missing that is overwriting each time that a contact sends a request?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance, have a great week&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 18:28:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/623980#M52710</guid>
      <dc:creator>rechavar</dc:creator>
      <dc:date>2022-04-28T18:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/624589#M52748</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/376955"&gt;@rechavar&lt;/a&gt; , I believe the property field type that you would want to use is a &lt;STRONG&gt;checkbox.&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/crm/properties" target="_blank" rel="noopener"&gt;See here&lt;/A&gt; for more info on properties&lt;/P&gt;
&lt;P&gt;You can patch that property, but when you patch it, you will need to include all checked options in the new request.&amp;nbsp; If you only include the newest, the older one will be removed.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/144301"&gt;@taran42&lt;/a&gt; any suggestions from your end?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 15:53:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/624589#M52748</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2022-04-29T15:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/624735#M52768</link>
      <description>&lt;P&gt;Ohhh thanks, ill try it and if it workz im gonna accept it as Solution, but, just to be clear, at the end of the day im gonna see in hubspot something like this?(where you see lists "[]" its mean that the info in that field needs to be append):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;name: jhon&lt;BR /&gt;last_name: perez&lt;BR /&gt;city: virgia beach&lt;BR /&gt;state: VA&lt;BR /&gt;project_names: ["12x30 barn", "18x22 metal garage", "12 x 25 carport"]&lt;/P&gt;&lt;P&gt;Suppliers: ["Alans factory", "catapult steel buildings", "UMB"]&lt;BR /&gt;prices: ["2000", "49000", 50000"]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you so much for your answer!! appreciated it&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 18:42:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/624735#M52768</guid>
      <dc:creator>rechavar</dc:creator>
      <dc:date>2022-04-29T18:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/624737#M52769</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/13982"&gt;@dennisedson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like Dennis said, you might want to use a checkbox or even a multiselect. If you go for a multiselect, you need a function to check if the option is present, and if not, add it.&lt;BR /&gt;You could also go for a single-line text, but in that case, you would also need to first retrieve the contact and the property you want to append a value to and add the value instead.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am not great with Python, but could share some NodeJS examples.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 18:45:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/624737#M52769</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-04-29T18:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/624764#M52776</link>
      <description>&lt;P&gt;Im needing the checkbox option, well I guess. Using some king of json sintax, this is what i need at the end of the day:&lt;/P&gt;&lt;P&gt;name: jhon&lt;BR /&gt;last_name: perez&lt;BR /&gt;city: virgia beach&lt;BR /&gt;state: VA&lt;BR /&gt;project_names: ["12x30 barn", "18x22 metal garage", "12 x 25 carport"]&lt;/P&gt;&lt;P&gt;Suppliers: ["Alans factory", "catapult steel buildings", "UMB"]&lt;BR /&gt;prices: ["2000", "49000", 50000"]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;would be great if you can share with me the NodeJs example, thanks my man, appreciated it!!!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 21:18:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/624764#M52776</guid>
      <dc:creator>rechavar</dc:creator>
      <dc:date>2022-04-29T21:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/625296#M52794</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/376955"&gt;@rechavar&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote this real quick, but it retrieves the properties&amp;nbsp;of the contact and checks if it includes the new value. If not, it adds the value and updates the contact. If you use an API key instead of a private app token, remove the 'authorization' header and add the API key to the URL.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;let needToUpdate = false

const getCurrentContact = async (contactId, token) =&amp;gt; {
  return axios({
    method: 'get',
    url: `https://api.hubapi.com/crm/v3/objects/contacts/${contactId}?properties=project_names&amp;amp;properties=suppliers&amp;amp;properties=prices`,
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    }
  }).then((response) =&amp;gt; {
    if (response.data.properties) {
      return response.data.properties
    } else {
      return false
    }
  }).catch((error) =&amp;gt; {
    console.log(`Error while retrieving contact: ${error.response.data.message}`)
    return false
  })
}

const updateContact = async (contactProperties, contactId, token) =&amp;gt; {
  const data = contactProperties

  return axios({
		method: 'patch',
		url: `https://api.hubapi.com/crm/v3/objects/contacts/${contactId}`,
		headers: {
			'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
		},
    data: JSON.stringify(data)
	}).then((response) =&amp;gt; {
    return response
  }).catch((error) =&amp;gt; {
    console.log(`Error while updating contact: ${error.response.data.message}`)
    return false
  })
}

const currentContactProperties = await getCurrentContact(contactId, token)

if (!currentContactProperties.project_names.includes(myNewProjectValue)) {
  currentContactProperties.project_names.push(myNewProjectValue)
  needToUpdate = true
}

if (!currentContactProperties.suppliers.includes(myNewSupplierValue)) {
  currentContactProperties.suppliers.push(myNewSupplierValue)
  needToUpdate = true
}

if (!currentContactProperties.prices.includes(myNewPricesValue)) {
  currentContactProperties.prices.push(myNewPricesValue)
  needToUpdate = true
}

if (needToUpdate) {
  const updatedContact = await updateContact(currentContactProperties, contactId, token)
  console.log(updatedContact)
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 06:10:56 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/625296#M52794</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-05-02T06:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/625471#M52815</link>
      <description>&lt;P&gt;Thank you so much my man, really appreciated it!!! this everything im needing!!!&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 13:29:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/625471#M52815</guid>
      <dc:creator>rechavar</dc:creator>
      <dc:date>2022-05-02T13:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/625476#M52816</link>
      <description>&lt;P&gt;Awesome! Happy I could help.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 13:34:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/625476#M52816</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-05-02T13:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: append info instead of overwriting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/632355#M53176</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/376955"&gt;@rechavar&lt;/a&gt;&lt;A href="https://apkkernal.com/prequel-mod-apk/" target="_blank" rel="noopener"&gt;prequel&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote this real quick, but it retrieves the properties&amp;nbsp;of the contact and checks if it includes the new value. If not, it adds the value and updates the contact. If you use an API key instead of a private app token, remove the 'authorization' header and add the API key to the URL.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let needToUpdate = false

const getCurrentContact = async (contactId, token) =&amp;gt; {
  return axios({
    method: 'get',
    url: `https://api.hubapi.com/crm/v3/objects/contacts/${contactId}?properties=project_names&amp;amp;properties=suppliers&amp;amp;properties=prices`,
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    }
  }).then((response) =&amp;gt; {
    if (response.data.properties) {
      return response.data.properties
    } else {
      return false
    }
  }).catch((error) =&amp;gt; {
    console.log(`Error while retrieving contact: ${error.response.data.message}`)
    return false
  })
}

const updateContact = async (contactProperties, contactId, token) =&amp;gt; {
  const data = contactProperties

  return axios({
		method: 'patch',
		url: `https://api.hubapi.com/crm/v3/objects/contacts/${contactId}`,
		headers: {
			'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
		},
    data: JSON.stringify(data)
	}).then((response) =&amp;gt; {
    return response
  }).catch((error) =&amp;gt; {
    console.log(`Error while updating contact: ${error.response.data.message}`)
    return false
  })
}

const currentContactProperties = &amp;lt;a href="https://apkkernal.com/prequel-mod-apk/"&amp;gt;prequel&amp;lt;/a&amp;gt; getCurrentContact(contactId, token)

if (!currentContactProperties.project_names.includes(myNewProjectValue)) {
  currentContactProperties.project_names.push(myNewProjectValue)
  needToUpdate = true
}

if (!currentContactProperties.suppliers.includes(myNewSupplierValue)) {
  currentContactProperties.suppliers.push(myNewSupplierValue)
  needToUpdate = true
}

if (!currentContactProperties.prices.includes(myNewPricesValue)) {
  currentContactProperties.prices.push(myNewPricesValue)
  needToUpdate = true
}

if (needToUpdate) {
  const updatedContact = await updateContact(currentContactProperties, contactId, token)
  console.log(updatedContact)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thankyou so much it helped me also. Finally i ran it without getting any errors.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 10:42:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/append-info-instead-of-overwriting/m-p/632355#M53176</guid>
      <dc:creator>JMark2</dc:creator>
      <dc:date>2022-05-13T10:42:42Z</dc:date>
    </item>
  </channel>
</rss>

