TRAI DLT-compliant routes on Jio, Airtel, Vi and BSNL
CRM integration

HubSpot SMS Integration: Send SMS from HubSpot Workflows

Send an SMS when a contact signs up, a deal closes or a ticket changes. A HubSpot workflow calls our SMS API directly with a webhook action or a few lines of custom code. There is nothing to install, but set up your DLT templates and your API key's allowed IP addresses first.

Updated · 14 min read · OnlineSMSService team, Coimbatore

Quick answer

A HubSpot workflow can send SMS through OnlineSMSService with one HTTPS call to https://whitelabled.securesmsc.com/api/v2/sms/send. Use the Send a webhook action for a fixed message, or a custom code action (Node.js 24) to fill template variables, clean phone numbers and keep the result. Both actions need Data Hub Professional or Enterprise (formerly Operations Hub). Before the first call, create a separate API key for HubSpot and add HubSpot's IP ranges to it. Otherwise the key locks to the first HubSpot server that uses it, and calls from other servers fail with 403.

What you can automate

Any contact, deal or ticket workflow can send an SMS. Common examples:

Sign-ups and form fills

Confirm a registration or an enquiry within seconds of the form being submitted.

Deal stage changes

Tell a customer their order is confirmed or their quote is ready.

Ticket updates

Send the ticket number when a ticket opens, and a message when it closes.

Reminders

Use a workflow delay to remind people of a meeting, a renewal or a payment.

Each message must match a DLT template that is approved in the right category. Service and transactional templates can go out at any time. Promotional messages go out only between 9 AM and 9 PM. See what the -P, -S, -T and -G header suffixes mean.

Prerequisites

  • Data Hub Professional or Enterprise. HubSpot needs it for both the "Send a webhook" action and custom code actions. Operations Hub was renamed Data Hub in September 2025. This is from HubSpot's knowledge base and developer docs, checked on 7 November 2026.
  • An OnlineSMSService account and an API key for HubSpot only. Sign up, then create a key under API & Integrations → API Management. Don't reuse the key your website or server uses.
  • An approved DLT header (sender ID, for example ACMEIN) mapped to your account, and an approved DLT template for every message. We file DLT registration for you: a new registration costs ₹5,900 (₹5,000 + 18% GST) and is valid for one year and renewed every year. Renewal is separate, and we remind you before it lapses. Linking an entity you already have is free. Approval usually takes 2–7 business days.
  • HubSpot's IP ranges added to the key. This is the next section, and it matters most.

Get a free API key + 100 test SMS. Create your account and API key now. Verified businesses also get 100 free test SMS once KYC and DLT mapping are done.

Allow HubSpot's IP ranges before the first call

This is the most common reason CRM integrations fail. Each API key has its own list of allowed IP addresses. If the list is empty, the first IP that calls with the correct key is added to it automatically. After that, every other IP gets 403 "IP address not allowed. Please whitelist your IP address to access the API." HubSpot runs workflows on many servers, so the first SMS works and later ones fail.

  1. Create a separate API key for HubSpotOne key per integration means a change for HubSpot never breaks your website or app.
  2. Add HubSpot's ranges before the first callOpen API & Integrations → API Management → IP Whitelisting for that key. Add single IPs or IPv4 ranges in CIDR form. Once the list has at least one entry, nothing is added automatically.
  3. Already locked to one IP?Add the full list first, then remove the wrong IP. If you remove it first, the list is empty for a moment and locks again to the next caller. You can also ask our support team to reset the key's list.

Where to get HubSpot's ranges. HubSpot publishes its IP ranges at api.hubapi.com/meta/network-origins/2026-09/ip-ranges, and the IP ranges guide explains it. No login is needed. On 7 November 2026 it listed these outgoing (EGRESS) ranges for "API & 3rd party integrations":

54.174.62.128/26
143.244.87.0/25
216.157.40.32/27
216.157.41.32/27
216.157.42.32/27

HubSpot's workflow docs don't say whether every webhook and custom-code request comes from these ranges. So add them, send one test, and if a call is still refused, ask our support team. We can see the refused IP in the key's log. HubSpot says the ranges change over time, so check the list now and then.

Still blocked? If the requests keep arriving from addresses outside the published ranges, contact our support with the 403 response and the time of the request, and we will help you set up the allow-list for that key.

Method 1: "Send a webhook" action (no code)

The webhook action suits messages with no variables, or where a contact property already holds the finished text.

  1. Add the actionIn the workflow editor, click the + icon, and in the Data ops section select Send a webhook.
  2. Method and URLChoose POST and enter https://whitelabled.securesmsc.com/api/v2/sms/send. HubSpot accepts HTTPS URLs only.
  3. AuthenticationChoose authentication type API key. Set the API key name to X-API-Key and the location to Request header. Then pick a secret that holds your OnlineSMSService key (for example ONLINESMS_API_KEY).
  4. Request bodySelect Customize request body and add the keys sender_id (static value ACMEIN), recipient (the Mobile phone number property) and message (static text of your approved template).
  5. Rate limitUse the action's rate-limit setting to stay under your key's limit, which is 60 requests a minute by default.
  6. TestUse Test action with a contact that has your own mobile number. It sends a real request, so it sends a real SMS. Check the Request and Response tabs.

With those keys, the request body is a JSON object like this:

{"sender_id":"ACMEIN","recipient":"+919876543210","message":"Thanks for registering with Acme. Your account is now active. -ACME"}

A successful call returns:

{"success":true,"message":"SMS queued successfully","data":{"message_id":123,"queue_id":123,"status":"queued","estimated_delivery":"2026-11-07T10:02:00.000000Z"}}

Know the webhook's limits. Each key takes one property or one static value, so you can't build "Hi " plus a first name in one field. The webhook also can't clean data. A number stored as +91 98765 43210 fails with 422, because the API accepts only 9876543210 or +919876543210. HubSpot retries a failed webhook for up to three days when the reply is 429 or a 5xx error, and doesn't retry other 4xx errors. For templates with variables, or messy phone numbers, use Method 2.

Method 2: custom code action (Node.js 24)

A custom code action runs a short JavaScript function inside the workflow. It can fill your template, clean the number and pass the result on to later actions.

  1. Add the actionIn the workflow editor, add a Custom code action and choose Node.js 24. HubSpot stopped new Node.js 20 actions on 3 November 2026, and existing ones must move to Node.js 24 before 17 November 2026.
  2. Add the secretAdd a secret named ONLINESMS_API_KEY holding your API key. The code reads it as process.env.ONLINESMS_API_KEY.
  3. Choose the propertiesUnder properties to include in code, add firstname (First name) and mobilephone (Mobile phone number).
  4. Paste the codeChange the sender ID and the message to your approved header and template.
  5. Define the outputsAdd three string outputs: sms_status, sms_message_id and sms_error. Later actions can copy them into contact properties or branch on them.

Custom code (Node.js 24)

// HubSpot custom code action (Node.js 24) – sends one SMS through OnlineSMSService.
// Secret: ONLINESMS_API_KEY. Properties to include in code: firstname, mobilephone.
const axios = require('axios');

const API_URL = 'https://whitelabled.securesmsc.com/api/v2/sms/send';
const SENDER_ID = 'ACMEIN';     // your approved DLT header
const DLT_TEMPLATE_ID = '';     // optional; keep it a string, e.g. '1107xxxxxxxxxxxxxxx'

// "+91 98765-43210" -> "9876543210" (the API rejects spaces and dashes)
function indianMobile(raw) {
  const digits = String(raw || '').replace(/\D/g, '');
  return digits.length > 10 ? digits.slice(-10) : digits;
}

exports.main = async (event, callback) => {
  const firstName = String(event.inputFields.firstname || 'Customer').trim().slice(0, 40);
  const mobile = indianMobile(event.inputFields.mobilephone);
  if (mobile.length !== 10) {
    return callback({ outputFields: { sms_status: 'skipped', sms_message_id: '', sms_error: 'No valid 10-digit mobile number' } });
  }

  // Approved DLT template: "Hi {#alphanumeric#}, thanks for registering with Acme. Your account is now active. -ACME"
  const message = `Hi ${firstName}, thanks for registering with Acme. Your account is now active. -ACME`;

  const body = { sender_id: SENDER_ID, recipient: mobile, message };
  if (DLT_TEMPLATE_ID) body.dlt_template_id = DLT_TEMPLATE_ID;

  try {
    const res = await axios.post(API_URL, body, {
      headers: { 'X-API-Key': process.env.ONLINESMS_API_KEY, Accept: 'application/json' },
      timeout: 15000, // HubSpot stops the action after 20 seconds
    });
    return callback({ outputFields: {
      sms_status: res.data.data.status,                  // "queued"
      sms_message_id: String(res.data.data.message_id),
      sms_error: '',
    } });
  } catch (err) {
    const status = err.response ? err.response.status : 0;
    // 429 and 5xx: throw, so HubSpot retries the action (for up to three days)
    if (status === 429 || status >= 500) throw err;
    // Everything else needs a fix on your side, so record it instead of retrying.
    // (A timeout lands here too: the SMS may already be queued, so a retry could send it twice.)
    const d = (err.response && err.response.data) || {};
    const reason = d.error_code || d.error || err.code || 'ERROR';
    return callback({ outputFields: {
      sms_status: 'failed',
      sms_message_id: '',
      sms_error: `${status} ${reason}: ${d.message || err.message}`.slice(0, 250),
    } });
  }
};

What the code does:

  • It turns +91 98765-43210 into 9876543210, and skips contacts with no valid number.
  • It fills the template with the first name, capped at 40 characters, the limit for an alphanumeric DLT variable.
  • It posts JSON with axios, which HubSpot provides. The key goes in the X-API-Key header from the secret.
  • It gives up after 15 seconds. HubSpot stops custom code after 20 seconds and 128 MB of memory.
  • On 429 or a 5xx error it throws, so HubSpot retries the action for up to three days. HubSpot retries only when the code throws. Other errors need a fix on your side, so they go into sms_error. A timeout is not retried either, because the SMS may already be queued and a retry could send it twice.

We tested this code on Node.js 24 with axios 1.21. Against our live API with a dummy key, it returned sms_status: "failed" and sms_error: "401 Unauthorized: Invalid API key". Against a local copy of the API, it returned queued with the message ID. It recorded 403, 401 and TEMPLATE_MISMATCH replies, and threw on 429 and 500.

Field mapping

API fieldHubSpot valueRules
sender_idStatic value, e.g. ACMEINRequired. An approved DLT header on your account, up to 11 characters (headers are 6).
recipientMobile phone number (mobilephone) or Phone number (phone)Required. 9876543210 or +919876543210. No spaces, dashes or brackets.
messageStatic text (webhook) or text built in codeRequired. Up to 1,600 characters, and it must match an approved template.
dlt_template_idStatic valueOptional. It must reach us as text. If you get "must be a string", leave it out.
routetransactional or promotionalOptional. Default is transactional. Leave it out rather than sending it empty.

Match the message to your DLT template exactly

Operators compare every SMS with your approved templates. The fixed words must be identical. Only the variable parts may change. Say this template is approved:

Hi {#alphanumeric#}, thanks for registering with Acme. Your account is now active. -ACME

Then "Hi Priya, thanks for registering with Acme. Your account is now active. -ACME" passes. "Hi Priya! Thanks for registering…" does not. Check these points:

  • Copy the fixed text from your DLT portal into HubSpot or the code. Don't retype it. Spaces, commas and full stops count.
  • No empty variables. The code uses "Customer" when the first name is missing, and that word must also suit the template. In the webhook, add an enrollment filter so contacts without the property don't enter the workflow.
  • Values must fit the variable type. An alphanumeric variable holds up to 40 characters, and a numeric one holds digits only. See DLT template variable tags.
  • Watch for Unicode. A curly quote or ₹ sign makes the whole SMS Unicode. Each SMS then holds 70 characters, not 160. Check long messages with the SMS character counter.
  • Test new wording first with the DLT template checker.

If you leave dlt_template_id out, our platform matches the text against your approved templates and rejects a mismatch at once with TEMPLATE_MISMATCH. If you send it, the platform may skip its own check, and the operator's DLT check becomes the only one. So leave it out while you test.

Test before you switch it on

  1. Set up the key firstUse the HubSpot-only key, with HubSpot's ranges already in its list.
  2. Don't try the HubSpot key from your laptopIf its list is still empty, that call locks the key to your laptop's IP. If the list is set, your laptop gets 403. Use a different key for manual tests in the API playground.
  3. Test with one contactUse a contact with your own mobile number and the action's Test button, or enroll that contact by hand. This sends a real SMS.
  4. Check the resultRead the outputs or the Response tab in HubSpot, and the SMS log in your OnlineSMSService dashboard.
  5. Then turn the workflow onIf many calls fail at once from the same IP, our security system can block that IP until our support team lifts the block, so fix any 401 or 403 errors first.

Troubleshooting

ResponseCauseFix
403 "IP address not allowed. Please whitelist your IP address to access the API."The key is locked to another IP, or this HubSpot server's IP is not in the key's list.Add HubSpot's ranges under IP Whitelisting, or ask support to reset the list. See above.
403 "Your IP address has been blocked due to suspicious activity…"Too many failed key checks came from that IP in a few minutes.Fix the key or IP problem, then contact support to unblock the IP.
401 "API key is required"No key reached us. The API key name or location is wrong, or the secret is empty.Use the header name X-API-Key, the location Request header, and check the secret.
401 "Invalid API key", "API key is disabled", "API key has expired" or "Account is not active"The key is wrong, switched off or expired, or the account is not active.Paste the key into the secret again, or create a new key.
400 "Invalid sender ID"sender_id is not an approved header on your account.Use the exact header shown in your dashboard.
422 "Validation failed", errors on recipientThe number has spaces or dashes, or the property is empty.Use Method 2, which cleans the number, or store numbers without spaces.
422 "The dlt template id field must be a string."The template ID arrived as a number.Leave dlt_template_id out, or send it as text.
422 TEMPLATE_MISMATCHThe text differs from every approved template.Compare it word for word with the template.
400 "SMS dispatch failed" with "Insufficient credits…"Your balance is too low.Top up. There is no minimum top-up.
429 "Rate limit exceeded"More than the key's limit (60 requests a minute and 10,000 a day by default).HubSpot retries on its own. Lower the action's rate limit, or ask us to raise yours.
Action errors after 20 secondsHubSpot's time limit for custom code.Keep the axios timeout under 20 seconds, as in the sample.

Other CRMs

Salesforce

An Apex service class, an async trigger, a Flow action and a test class, using a named credential.

Zoho CRM

A workflow webhook, or a Deluge function that saves the result on the lead.

Any other CRM

Any tool that can send an HTTPS POST with a JSON body and a custom header can use the same call. See the API docs and the Node.js guide.

Frequently asked questions

Is there a HubSpot app for OnlineSMSService?

No. We do not have a HubSpot Marketplace app. A HubSpot workflow calls the OnlineSMSService API directly, with the "Send a webhook" action or a custom code action.

Which HubSpot subscription do I need to send SMS from workflows?

Both the "Send a webhook" action and custom code actions need Data Hub Professional or Enterprise. Data Hub was called Operations Hub until September 2025.

Why did the first SMS from HubSpot work and the next ones fail with 403?

The API key locked itself to the IP address of the first HubSpot server that used it. HubSpot calls from many servers, so the others were refused. Add HubSpot's IP ranges to the key under API & Integrations, API Management, IP Whitelisting, or ask our support team to reset the key's list.

Which Node.js version should the custom code action use?

Node.js 24. HubSpot stopped new Node.js 20 custom code actions on 3 November 2026 and asks for existing ones to be moved to Node.js 24 before 17 November 2026.

Will HubSpot retry an SMS that failed?

The webhook action is retried for up to three days when our API replies 429 or a 5xx error, and not for other 4xx errors. A custom code action is retried only when the code throws, which the sample on this page does for 429 and 5xx replies.

Can I personalise the SMS with the contact's name?

Yes, with the custom code action. The webhook action maps each field to one property or one static value, so it cannot combine fixed text with a name. The final text must still match your approved DLT template.

Do I need DLT registration to send SMS from HubSpot?

Yes. Every business SMS in India needs a registered entity, an approved header and approved content templates on a DLT portal. A new DLT registration filed through us costs ₹5,900 (₹5,000 + 18% GST) and is valid for one year and renewed every year. Renewal is separate, and we remind you before it lapses. Linking an entity you already have is free.

How much does it cost to send SMS from HubSpot?

SMS cost ₹0.20 each on Starter (up to 10,000 a month) and ₹0.15 on Business (up to 1,00,000 a month), plus 18% GST. Above 1,00,000 a month, Enterprise pricing is custom. You pay per delivered message, with no setup or monthly fee. Your HubSpot subscription is separate.

Get a free API key + 100 test SMS

Create your account and generate an API key right away. Verified businesses also get 100 free test SMS once KYC and DLT mapping are done. No setup fee, no minimum top-up, and credits never expire.

Get 100 free SMS
Claim 100 free SMS