<?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 DealStage Label name is required instead of internal name in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/DealStage-Label-name-is-required-instead-of-internal-name/m-p/951406#M72312</link>
    <description>&lt;P&gt;I am using an API call to fetch the field values for deal but for dealstage instead of the label its giving me internal name.&lt;/P&gt;&lt;P&gt;Below is the API and other details.&lt;/P&gt;&lt;P&gt;API:&amp;nbsp;&lt;A href="https://api.hubapi.com/crm/v3/objects/deals/search" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/deals/search&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Payload:&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"properties":&amp;nbsp;[&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"hs_object_id",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"dealname",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"dealstage",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"filterGroups":&amp;nbsp;[&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"filters":&amp;nbsp;[&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"propertyName":&amp;nbsp;"createdate",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"operator":&amp;nbsp;"GTE",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"value":&amp;nbsp;"2024-03-26T10:53:25Z"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;]&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 28 Mar 2024 13:38:34 GMT</pubDate>
    <dc:creator>MSrivastava1</dc:creator>
    <dc:date>2024-03-28T13:38:34Z</dc:date>
    <item>
      <title>DealStage Label name is required instead of internal name</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/DealStage-Label-name-is-required-instead-of-internal-name/m-p/951406#M72312</link>
      <description>&lt;P&gt;I am using an API call to fetch the field values for deal but for dealstage instead of the label its giving me internal name.&lt;/P&gt;&lt;P&gt;Below is the API and other details.&lt;/P&gt;&lt;P&gt;API:&amp;nbsp;&lt;A href="https://api.hubapi.com/crm/v3/objects/deals/search" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/deals/search&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Payload:&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"properties":&amp;nbsp;[&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"hs_object_id",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"dealname",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"dealstage",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"filterGroups":&amp;nbsp;[&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"filters":&amp;nbsp;[&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"propertyName":&amp;nbsp;"createdate",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"operator":&amp;nbsp;"GTE",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"value":&amp;nbsp;"2024-03-26T10:53:25Z"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;]&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 13:38:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/DealStage-Label-name-is-required-instead-of-internal-name/m-p/951406#M72312</guid>
      <dc:creator>MSrivastava1</dc:creator>
      <dc:date>2024-03-28T13:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: DealStage Label name is required instead of internal name</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/DealStage-Label-name-is-required-instead-of-internal-name/m-p/951473#M72317</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/734792"&gt;@MSrivastava1&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yeah it's a real pain, but I can see why it's been structured this way.&lt;BR /&gt;&lt;BR /&gt;Anyway, I'd be tempted to add in a second step and use the pipelines API to pull the internal ID and DealStage value pair JSON, then iterate through them to find your label match.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const hubspot = require('@hubspot/api-client');

exports.main = async (event, callback) =&amp;gt; {

  const hubspotClient = new hubspot.Client({"accessToken":"YOUR ACCESS TOKEN HERE"});

  const dealStageInternal = event.inputFields['dealstage'];
  let dealStageLabel = ""; 
  
const objectType = "deal";
const pipelineId = "PUT THE ID OF YOUR PIPELINE";

try {
  const apiResponse = await hubspotClient.crm.pipelines.pipelineStagesApi.getAll(objectType, pipelineId);
  
for (let i = 0; i &amp;lt; apiResponse.results.length; i++) {
  console.log(`Checking id: ${apiResponse.results[i].id} against dealStageInternal: ${dealStageInternal}`);

  if (apiResponse.results[i].id == dealStageInternal) {
    dealStageLabel = apiResponse.results[i].label;
    console.log(`Match found: ${dealStageLabel}`);
    break; 
  }
}

if (!dealStageLabel) {
  console.log("No matching deal stage found.");
}
  
} catch (e) {
  e.message === 'HTTP request failed'
    ? console.error(JSON.stringify(e.response, null, 2))
    : console.error(e)
}
  
console.log(dealStageLabel); // Logs the label of the matching deal stage
  
 
  callback({
    outputFields: {
      email: email,
      dealStageLabel: dealStageLabel
    }
  });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Think it works, let me know how you get on &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 15:53:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/DealStage-Label-name-is-required-instead-of-internal-name/m-p/951473#M72317</guid>
      <dc:creator>EddBrisley</dc:creator>
      <dc:date>2024-03-28T15:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: DealStage Label name is required instead of internal name</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/DealStage-Label-name-is-required-instead-of-internal-name/m-p/951474#M72318</link>
      <description>&lt;P&gt;Hey, &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/734792"&gt;@MSrivastava1&lt;/a&gt;&lt;/SPAN&gt; &lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; The endpoint will always return the internal value and not the label. The solution &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/726665"&gt;@EddBrisley&lt;/a&gt;&lt;/SPAN&gt; suggested is a great approach to consider.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Jaycee&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 15:47:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/DealStage-Label-name-is-required-instead-of-internal-name/m-p/951474#M72318</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2024-03-28T15:47:14Z</dc:date>
    </item>
  </channel>
</rss>

