How to enable/disable features when deploy the app?

I created an app with two profile, (profileA and profileB). Both profiles point to the same account. I’d like to create two apps (one for each profile). And one profileA enable the webhook while the other profileB disable the webhook.

The reason I am trying to do this is to get around the api limit (100 per 10 seconds). If I create two apps, my application can use two clientId and clientSeceret which I will get double limits. However, I only want to have one webhook because I will get duplicate webhook events if I enable both.

Is there a way to achieve that?

Hi @JZhao and Happy Thursday!
Thanks for reaching out to the HubSpot Community!
I’d love to put you in touch with our Top Experts: Hi @Mike_Eastwood, @Anton and @evaldas do you have any insights to share with @JZhao, please?
Thanks so much and have a fabulous day! :sun_with_face:
Bérangère

Hey @JZhao

Creative approach but it might cause you more headaches than it solves. Running two apps against the same portal to double your rate limit technically works for the API calls, but managing duplicate webhook suppression across two apps adds a whole layer of complexity. If HubSpot ever changes how they enforce limits per portal (rather than per app), your setup could break unexpectedly too.

For the webhook piece specifically, yes you can just not subscribe to webhook events on profileB’s app settings. When you configure your app in the developer portal you choose which subscriptions to enable, so just leave those unchecked on the second app and you wont get duplicates (https://developers.hubspot.com/docs/api-reference/webhooks-webhooks-v3/guide). That part should work fine.

But I’d push back a bit on the overall strategy. If you’re consistently hitting 100 per 10 seconds, there might be room to optimize the calls themselves. Batching reads with the search API or using the batch endpoints for creates and updates can dramatically reduce your call count. The batch CRM API lets you handle up to 100 records in a single request which is way more efficient than individual calls (https://developers.hubspot.com/docs/api-reference/crm-deals-v3/guide#create-deals )

We ran into this exact rate limit wall at Stacksync early on when syncing large HubSpot portals and switching to batch operations plus smart request queuing made the dual app approach unnecessary for us. Worth trying that before committing to the two app architecture. Note: This response was written based on my own experience and lightly reformatted with AI for clarity.

Hope this helps!

Hi Ruben,

Thanks for your message. I already start using batch API which is not good enough to handle the traffic. My business is growing too fast and going forward, two apps is not good enough. I am thinking to create a pool of apps and my application will pick the token from the pool like round robin. I don’t have any better way to handle that.

Hi @JZhao

Each app will have it’s own API limits – per Portal – per App – so you probably do not need to duplicate the app.

You can use the context data in your app to switch webhooks based on the user/portal. e.g. context.user.id

But, the limits are generous, why do you need so many API calls?

Are you using batching with your API calls?

Curiously

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of Webalite a Gold HubSpot Partner Agency based in Wellington, New Zealand and the founder of Portal-iQ the world’s first automated HubSpot Portal Audit that helps you work smarter with HubSpot.

I need to update more than 50 properties values for each record in HS each day. And there are over 20000 records and the number is growing up. I thought the limit is on App level. If I create two apps, will each app has its own limit or two apps share the same limit?

Can you be more specific about how to use "context.user.id" to switch webhook?

If you batch update all 50 properties, for 100 Contacts, that’s only 200 API Calls so you’re done in under a minute, easy. No need for multiple apps.

I use the context data in my app to activate, or deactivate, features based on the user. For example in our new QTRBK we have User Roles (stored in our database) and if the HubSpot User (context.user.id) is in the Team (and array of IDs from our server) then the Edit Team button is active, if they aren’t in the array then the Edit Team button is deactivated.

Have fun

Mike

The problem I am facing is how to deploy two apps from the same project. There is only one “hsproject.json” which has project name in it. Do I need to create two project file? How to specify different project file?

Hi @JZhao

Personally, I think it sounds like a bad idea creating two apps that do the same job.

I have created a deployment script that changes the details in hsproject.json (and other files) so that I can deploy a Dev, Staging and Production version of my app. Each app is a separte project in my HubSpot Developer Account. This allows me to test and deploy the code before it goes into production. Only one app is going to be listed in the marketplace. The Dev and Staging Apps are only installed in Test Accounts.

However, it’s best to refactor your app to use batching and queue management to run only one app within the HubSpot API limits.

–Mike

Hi Mike,

I already use the batch API but it still hits the limit very often. I don’t know how to improve it without creating two apps.

I am using different profile to deploy to different accounts like `dev, staging, prod`. But I am looking for how to create two apps within the same profile to one account.

Hi @Mike_Eastwood, thanks so much for your help!
Do you have further tips for @JZhao, please?
Thanks so much and have a great day!
Bérangère

Hey @JZhao, getting back to you on this!
So, projects in HubSpot can include multiple apps, here is the documentation about it “Creating private apps with projects”.

This means you have the flexibility to create two apps within the same project and deploy them to the same account, all with a single profile.
Even better, each privately distributed app has its own burst rate limit (for example, 190 requests per 10 seconds on Professional/Enterprise plans), while the daily limit is shared across all apps within the account.

If you’re looking to balance your API load, you can split your API calls between two apps in the same project. This effectively doubles your burst capacity per 10 seconds, super helpful for high-traffic scenarios!

And when it comes to config profiles, each one is designed to target just one account, so your dev, staging, and prod profiles can each deploy your multi-app project to the corresponding accounts with ease.

I hope this helps!
Bérangère
This post was created with the assistance of AI tools