All guides All guides

Basics

Automation tools

CRM and email

Guides CRM and email

How to run HubSpot workflow actions only during each contact's business hours

Short answer: HubSpot can delay workflow actions to a set day or time, but it does not know the public holidays in each contact's country. Add a custom code action that asks Netsware whether the contact's business is open right now (GET /v1/check with their country and timezone), then branch on its open output. On a public holiday, a weekend or outside business hours for that contact, the workflow waits until the next opening time instead of sending, with no holiday list to maintain.


Why HubSpot workflows reach contacts on their holidays

A HubSpot workflow sends a follow-up email, creates a call task for a sales rep or notifies a customer, and the contacts are in different countries. A contact in Japan receives a "quick question" email on Labour Thanksgiving Day, and a contact in the UAE receives it on their weekend. Each send looks careless, and it lands at the bottom of a full inbox the next morning.

HubSpot can delay actions to a set day or time, but it does not know each country's public holidays, and maintaining a holiday list for every country by hand is not realistic.

How Netsware works with HubSpot

Netsware does not have a HubSpot app, and you do not connect your HubSpot account to it. A HubSpot custom code action asks Netsware, for each contact, whether their business is open right now, and the workflow branches on the answer.

You need:

  • a HubSpot plan that includes custom code actions (Data Hub Professional or Enterprise),
  • a Netsware API key: create one in the Netsware dashboard under API Keys. The free plan is enough to start.

Step 1: Give each contact a country code and a timezone

Netsware needs a two-letter country code (like JP or GB) and a timezone name in IANA format (like Asia/Tokyo, not "JST"), or it rejects the check. HubSpot's built-in country field is free text, so add two contact properties, for example Netsware country and Netsware timezone, and fill them from your forms or imports.

Step 2: Store your Netsware API key as a HubSpot secret

In the custom code action, add a secret named NETSWARE_KEY with your Netsware API key. Never paste the key into the code itself.

Step 3: Add the custom code action

Add a Custom code action to the workflow, choose Node.js, and map two inputs: country and timezone from the properties in step 1. Then use this code:

const axios = require('axios');

exports.main = async (event, callback) => {
  const country = event.inputFields['country'];
  const timezone = event.inputFields['timezone'];

  try {
    const { data } = await axios.get('https://app.netsware.com/v1/check', {
      params: { country, timezone, open_time: '09:00', close_time: '18:00' },
      headers: { 'X-API-Key': process.env.NETSWARE_KEY },
      timeout: 10000,
    });
    callback({
      outputFields: {
        open: data.open === true,
        reason: data.reason || '',
        next_open: data.next_open ? Date.parse(data.next_open.utc) : null,
      },
    });
  } catch (err) {
    // Throwing lets HubSpot retry rate limits (429) and server errors (5xx).
    // A 4xx (for example an invalid country or timezone) fails the action for this contact.
    throw err;
  }
};

Declare three outputs: open (boolean), reason (string) and next_open (datetime).

Netsware doesn't guess the weekend: it uses the open days you pass, Monday to Friday by default. For a Friday and Saturday weekend, as in Saudi Arabia, add days: 'SUN,MON,TUE,WED,THU' to params (or store the days per contact too).

Step 4: Branch on the open output

Add a branch, choose One property or action output, and pick the custom code output open (is equal to true):

  • Open: send the email or create the task.
  • Closed: add an Edit record action that sets a contact date and time property (for example Next open time) from the code's next_open output. Then add a Delay until a date property on Next open time, with "Use the time from the date property", and then send. If that time has already passed, HubSpot moves the contact straight on.

Now every contact hears from you during their own working hours, and never on their public holidays.

Cost note: each check is one Netsware API request against your plan's monthly quota (20,000 on the free plan). A workflow that checks 300 contacts a day uses about 9,000 requests a month.


Team-level runs instead

If you don't need per-contact timing, only "every working morning at 09:00 in the UK office", you don't need custom code. Create a Netsware job on a business-hours schedule, and either:

  • call your own endpoint that does the HubSpot work (see How to run a webhook only during business hours), or
  • call HubSpot's API directly for a fixed request: store your HubSpot private app token in Netsware as a secret variable with allowed_destinations set to api.hubapi.com, and reference it in the job's Authorization header.

When a run lands on a holiday, Netsware holds it until the next opening and logs the reason (for example public_holiday). A Netsware job sends the same request each time, with your {{VARIABLES}} filled in. It decides when; who and what stay in HubSpot or your code.


FAQ

Is there a Netsware app in the HubSpot marketplace?

No. Netsware works with HubSpot through HubSpot's own custom code actions and API. You do not connect your HubSpot account, and Netsware receives only the country and timezone your code sends in each check.

How do I send HubSpot emails only during a contact's business hours?

Add a custom code action that calls GET /v1/check with the contact's country and timezone, then branch on open. When the business is closed, delay the contact until the next opening time that the check returns.

Can a Netsware job call the HubSpot API directly?

Yes, for a fixed request. Store your HubSpot private app token in Netsware as a secret variable with allowed_destinations set to api.hubapi.com, and reference it in the job's Authorization header. Netsware sends it only to that host and never shows it again.

Which countries are covered?

226 countries and territories, including regional and state holidays where they apply. The free Essentials plan includes 10 holiday countries: the US, India, the UK, Germany, France, Canada, Australia, Japan, Singapore and Brazil. Paid plans include all 226. On the free plan, a check for a country outside those 10 returns an error that names the plan needed, and the action fails for that contact, so contacts worldwide need a paid Netsware plan. GET /v1/hours/meta/countries returns every country's usual weekend.

What happens if the check fails?

If Netsware returns a rate-limit or server error, HubSpot retries the action for up to three days. If the request cannot complete, or the country or timezone is invalid, the action fails for that contact.

Does it cost anything?

The Netsware Essentials plan is free forever and does not require a credit card. Custom code actions require HubSpot Data Hub Professional or Enterprise.

Summary

HubSpot knows who to contact and what to send. Netsware knows when each contact's business is open. One custom code action and one branch time every message to the contact's own country, including public holidays and weekends, with no holiday list to maintain.

Related guides: How to run a webhook only during business hours · How to make Zapier skip weekends and public holidays · How to run a Make scenario only on working days

Start free. No credit card, no trial period. The Essentials plan is free forever, so you can build and test your software, apps and workflows for as long as you need, and upgrade only when you are ready.

Start free

Spotted a mistake or something out of date? Tell us and we will fix it.

Keep reading