<?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: Custom code to fetch Sequence name based on sequence id in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Custom-code-to-fetch-Sequence-name-based-on-sequence-id/m-p/1013850#M75191</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/797511"&gt;@StefSchad&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you are getting that 404 as the endpoint doesn't currently exist as part of &lt;A href="https://developers.hubspot.com/beta-docs/reference/api" target="_blank" rel="noopener"&gt;HubSpots APIs&lt;/A&gt;. Did you find that endpoint documented somewhere online and if so can you share documentation?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2024 10:40:46 GMT</pubDate>
    <dc:creator>coldrickjack</dc:creator>
    <dc:date>2024-07-22T10:40:46Z</dc:date>
    <item>
      <title>Custom code to fetch Sequence name based on sequence id</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Custom-code-to-fetch-Sequence-name-based-on-sequence-id/m-p/1013799#M75184</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to fetch the name of the sequence, based on the contact property "Last sequence enrolled" (which is an ID) and save it into a custom contact field (that I called "Last sequence enrolled name"). I created a private app and tried a custom code into a workflow. I always have an error message: &lt;SPAN&gt;"Request failed with status code 404" but I can't fix it. If someone could help, it would be great.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;const axios = require('axios');&lt;BR /&gt;const hubspot = require('@hubspot/api-client');&lt;/P&gt;&lt;P&gt;exports.main = async (event, context, callback) =&amp;gt; {&lt;BR /&gt;&lt;BR /&gt;const HUBSPOT_API_KEY = process.env.xxxx;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;const hubspotClient = new hubspot.Client({ accessToken: HUBSPOT_API_KEY });&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;const SEQUENCE_ID = 'hs_latest_sequence_enrolled';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;const CONTACT_ID = 'hs_object_id';&lt;/P&gt;&lt;P&gt;let sequenceName;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;const url = `&lt;A href="https://api.hubapi.com/automation/v3/sequences/${SEQUENCE_ID" target="_blank"&gt;https://api.hubapi.com/automation/v3/sequences/${SEQUENCE_ID&lt;/A&gt;}`;&lt;/P&gt;&lt;P&gt;const headers = {&lt;BR /&gt;Authorization: `Bearer ${HUBSPOT_API_KEY}`&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt;const response = await axios.get(url, { headers });&lt;BR /&gt;sequenceName = response.data.name;&lt;BR /&gt;console.log(`The name of the sequence is : ${sequenceName}`);&lt;/P&gt;&lt;P&gt;// Update the data of my custom property&lt;BR /&gt;const urlUpdate = `&lt;A href="https://api.hubapi.com/contacts/v1/contact/vid/${CONTACT_ID}/profile" target="_blank"&gt;https://api.hubapi.com/contacts/v1/contact/vid/${CONTACT_ID}/profile&lt;/A&gt;`;&lt;BR /&gt;const payload = {&lt;BR /&gt;properties: [&lt;BR /&gt;{&lt;BR /&gt;property: 'last_sequence_enrolled_name',&lt;BR /&gt;value: sequenceName,&lt;BR /&gt;},&lt;BR /&gt;],&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;await axios.post(urlUpdate, payload, { headers });&lt;BR /&gt;console.log(`The property "last_sequence_enrolled_name" was updated on this ${CONTACT_ID} with this value : ${sequenceName}`);&lt;BR /&gt;} catch (error) {&lt;BR /&gt;console.error(`Update error : ${error.message}`);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 09:33:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Custom-code-to-fetch-Sequence-name-based-on-sequence-id/m-p/1013799#M75184</guid>
      <dc:creator>StefSchad</dc:creator>
      <dc:date>2024-07-22T09:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Custom code to fetch Sequence name based on sequence id</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Custom-code-to-fetch-Sequence-name-based-on-sequence-id/m-p/1013850#M75191</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/797511"&gt;@StefSchad&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you are getting that 404 as the endpoint doesn't currently exist as part of &lt;A href="https://developers.hubspot.com/beta-docs/reference/api" target="_blank" rel="noopener"&gt;HubSpots APIs&lt;/A&gt;. Did you find that endpoint documented somewhere online and if so can you share documentation?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 10:40:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Custom-code-to-fetch-Sequence-name-based-on-sequence-id/m-p/1013850#M75191</guid>
      <dc:creator>coldrickjack</dc:creator>
      <dc:date>2024-07-22T10:40:46Z</dc:date>
    </item>
  </channel>
</rss>

