<?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: problem in calling external API from within hubspot extension in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1174893#M83140</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/882169"&gt;@SMukhhopadhya&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To make API requests within a HubSpot UI Extension, you should use hubspot.fetch() instead of the native fetch() method.&lt;BR /&gt;I recommend reviewing the official documentation here:&lt;BR /&gt;&lt;A href="https://developers.hubspot.com/docs/guides/crm/public-apps/fetching-data" target="_blank" rel="noopener noreferrer"&gt;https://developers.hubspot.com/docs/guides/crm/public-apps/fetching-data&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I hope this helps! If it resolves your issue, please consider marking this as the accepted solution and giving it an upvote to assist others in the community as well.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jul 2025 11:05:48 GMT</pubDate>
    <dc:creator>MKatewa</dc:creator>
    <dc:date>2025-07-10T11:05:48Z</dc:date>
    <item>
      <title>problem in calling external API from within hubspot extension</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135094#M81529</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a public app. Since serverless is not going to work so I created a backend which is hosted in aws and I am trying to call the API.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;1. I have created a API, created a domain using ngrok (an https call is required to be created, hence used it )&lt;BR /&gt;&lt;BR /&gt;2. I made the call using the following call.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;try {&lt;BR /&gt;const response = await fetch('&lt;A href="https://ec9b-54-158-1-10.ngrok-free.app/tracking" target="_blank" rel="noopener"&gt;https://ec9b-54-158-1-10.ngrok-free.app/tracking&lt;/A&gt;', {&lt;/P&gt;&lt;P&gt;method: 'GET',&lt;BR /&gt;headers: {&lt;BR /&gt;'Content-Type': 'application/json'&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;3. I get the following error.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Refused to connect to '&lt;A href="https://ec9b-54-158-1-10.ngrok-free.app/tracking" target="_blank" rel="noopener"&gt;https://ec9b-54-158-1-10.ngrok-free.app/tracking&lt;/A&gt;' because it violates the following Content Security Policy directive: "connect-src none".&lt;BR /&gt;&lt;BR /&gt;4. I find that the iframe sandbox has the following security policy and hence whenever I make a call I get an error that security policy is violated.&lt;BR /&gt;&amp;lt;iframe sandbox="&lt;STRONG&gt;allow-scripts allow-same-origin&lt;/STRONG&gt;" src="&lt;A href="https://static.hubspot-extensions.com/ui-extension/v1/sandbox.html" target="_blank" rel="noopener"&gt;https://static.hubspot-extensions.com/ui-extension/v1/sandbox.html&lt;/A&gt;" ...&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Under such a situation how do I call the hosted backend ? Since it is a public app so earlier it was suggested of not using serverless. A pointer in the direction would be helpful.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 07:07:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135094#M81529</guid>
      <dc:creator>SMukhhopadhya</dc:creator>
      <dc:date>2025-04-11T07:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: problem in calling external API from within hubspot extension</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135391#M81554</link>
      <description>&lt;P&gt;Hi, &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/882169"&gt;@SMukhhopadhya&lt;/a&gt;&lt;/SPAN&gt; &lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for your question! I'd like to invite some of our community experts to the conversation — 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/324811"&gt;@zach_threadint&lt;/a&gt;&lt;/SPAN&gt; &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/73772"&gt;@Kevin-C&lt;/a&gt;&lt;/SPAN&gt; &amp;nbsp;&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/9259"&gt;@Mike_Eastwood&lt;/a&gt;&lt;/SPAN&gt; have you tackled anything like this in your recent project work? Thanks! — Jaycee&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 19:42:52 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135391#M81554</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2025-04-11T19:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: problem in calling external API from within hubspot extension</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135429#M81559</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/882169"&gt;@SMukhhopadhya&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;Have you added the relevant domains to the "allowUrls" array in your &lt;EM&gt;public-app.json&lt;/EM&gt; file (see &lt;A href="https://developers.hubspot.com/docs/guides/crm/public-apps/fetching-data" target="_blank" rel="noopener"&gt;this HubSpot documentation&lt;/A&gt;)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;// Taken directly from HubSpot documentation: https://developers.hubspot.com/docs/guides/crm/public-apps/fetching-data
// See "Specify URLs to fetch from" section
// ----------------------------------------

// Example public-app.json
{
  "name": "My public app",
  "uid": "my-public-app",
  "description": "This is my public app.",
  "logo": "./my-company.png"
  "allowedUrls": [
    "https://app.example.com",
    "https://app.example2.com:8080",
    "https://api.example.com/user/",
    "https://api.example2.com/user"
  ]
 ...
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that proves helpful. Please let me know if you have any follow-up questions.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 22:01:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135429#M81559</guid>
      <dc:creator>zach_threadint</dc:creator>
      <dc:date>2025-04-11T22:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: problem in calling external API from within hubspot extension</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135443#M81561</link>
      <description>&lt;P&gt;oh yes, I had already done that , highlighted in bold. Please find my public-app.json as the sample. That had not solved the problem.&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;"name": "Hubspot UPS AppCard 04112025",&lt;BR /&gt;"uid": "get-started-public-app",&lt;BR /&gt;"description": "An example to demonstrate how to build a public app with developer projects.",&lt;BR /&gt;"allowedUrls": ["&lt;A href="https://api.hubapi.com" target="_blank"&gt;https://api.hubapi.com&lt;/A&gt;",&lt;BR /&gt;"&lt;A href="https://wwwcie.ups.com" target="_blank"&gt;https://wwwcie.ups.com&lt;/A&gt;",&lt;BR /&gt;"&lt;A href="https://54.158.1.10:3000/tracking" target="_blank"&gt;https://54.158.1.10:3000/tracking&lt;/A&gt;",&lt;BR /&gt;&lt;STRONG&gt;"&lt;A href="https://ec9b-54-158-1-10.ngrok-free.app/tracking" target="_blank"&gt;https://ec9b-54-158-1-10.ngrok-free.app/tracking&lt;/A&gt;"&lt;/STRONG&gt;&lt;BR /&gt;],&lt;BR /&gt;"auth": {&lt;BR /&gt;"redirectUrls": ["&lt;A href="http://localhost:3000/oauth-callback" target="_blank"&gt;http://localhost:3000/oauth-callback&lt;/A&gt;"],&lt;BR /&gt;"requiredScopes": ["crm.objects.deals.read", "crm.objects.deals.write","crm.objects.contacts.read", "crm.objects.contacts.write","oauth"],&lt;BR /&gt;"optionalScopes": [],&lt;BR /&gt;"conditionallyRequiredScopes": []&lt;BR /&gt;},&lt;BR /&gt;"support": {&lt;BR /&gt;"supportEmail": "support@example.com",&lt;BR /&gt;"documentationUrl": "&lt;A href="https://example.com/docs" target="_blank"&gt;https://example.com/docs&lt;/A&gt;",&lt;BR /&gt;"supportUrl": "&lt;A href="https://example.com/support" target="_blank"&gt;https://example.com/support&lt;/A&gt;",&lt;BR /&gt;"supportPhone": "+18005555555"&lt;BR /&gt;},&lt;BR /&gt;"extensions": {&lt;BR /&gt;"crm": {&lt;BR /&gt;"cards": [&lt;BR /&gt;{&lt;BR /&gt;"file": "./extensions/example-card.json"&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"webhooks": {&lt;BR /&gt;"file": "./webhooks/webhooks.json"&lt;BR /&gt;},&lt;BR /&gt;"serverless": {&lt;BR /&gt;"functions": {&lt;BR /&gt;"call-ups": {&lt;BR /&gt;"file": "call-ups.js",&lt;BR /&gt;"method": "GET",&lt;BR /&gt;"path": "/call-ups"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 23:23:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135443#M81561</guid>
      <dc:creator>SMukhhopadhya</dc:creator>
      <dc:date>2025-04-11T23:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: problem in calling external API from within hubspot extension</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135444#M81562</link>
      <description>&lt;P&gt;The other way of avoiding it ( I am not sure)&amp;nbsp; might be creating a serverless function. The extensions call the serverless functions. The serverless functions call the backend AWS API.&lt;BR /&gt;&lt;BR /&gt;The problem here is that I am not able to upload a serverless function. I have been trying to look through&amp;nbsp; to find out how a serverless functions configuration files should look like without success.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Does there exists a git project where there is some basic code with serverless function. I tried to move the public-app.json from within &amp;lt;project_root&amp;gt;/src/app to &amp;lt;project_root&amp;gt; and constantly getting errors as the following.&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;[ERROR] No *-hsmeta.json files found, make sure you are inside a project&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Searching the internet someone recommended that the serverlessDir is relative to the srcDir. But I am not sure if there is any mistake I am doing.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;"name":"Hubspot UPS AppCard",&lt;BR /&gt;"platformVersion":"2023.2",&lt;BR /&gt;"srcDir":"src",&lt;BR /&gt;"serverlessDir":&lt;STRONG&gt;"../serverless"&lt;/STRONG&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;But I could not find the serverless function anywhere when I did hs project upload.&lt;BR /&gt;~&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Apr 2025 23:34:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1135444#M81562</guid>
      <dc:creator>SMukhhopadhya</dc:creator>
      <dc:date>2025-04-11T23:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: problem in calling external API from within hubspot extension</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1174893#M83140</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/882169"&gt;@SMukhhopadhya&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To make API requests within a HubSpot UI Extension, you should use hubspot.fetch() instead of the native fetch() method.&lt;BR /&gt;I recommend reviewing the official documentation here:&lt;BR /&gt;&lt;A href="https://developers.hubspot.com/docs/guides/crm/public-apps/fetching-data" target="_blank" rel="noopener noreferrer"&gt;https://developers.hubspot.com/docs/guides/crm/public-apps/fetching-data&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I hope this helps! If it resolves your issue, please consider marking this as the accepted solution and giving it an upvote to assist others in the community as well.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2025 11:05:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/problem-in-calling-external-API-from-within-hubspot-extension/m-p/1174893#M83140</guid>
      <dc:creator>MKatewa</dc:creator>
      <dc:date>2025-07-10T11:05:48Z</dc:date>
    </item>
  </channel>
</rss>

