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.
- Create a separate API key for HubSpotOne key per integration means a change for HubSpot never breaks your website or app.
- 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.
- 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.
- Add the actionIn the workflow editor, click the + icon, and in the Data ops section select Send a webhook.
- Method and URLChoose POST and enter
https://whitelabled.securesmsc.com/api/v2/sms/send. HubSpot accepts HTTPS URLs only. - AuthenticationChoose authentication type API key. Set the API key name to
X-API-Keyand the location to Request header. Then pick a secret that holds your OnlineSMSService key (for exampleONLINESMS_API_KEY). - Request bodySelect Customize request body and add the keys
sender_id(static valueACMEIN),recipient(the Mobile phone number property) andmessage(static text of your approved template). - Rate limitUse the action's rate-limit setting to stay under your key's limit, which is 60 requests a minute by default.
- 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.
- 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.
- Add the secretAdd a secret named
ONLINESMS_API_KEYholding your API key. The code reads it asprocess.env.ONLINESMS_API_KEY. - Choose the propertiesUnder properties to include in code, add
firstname(First name) andmobilephone(Mobile phone number). - Paste the codeChange the sender ID and the message to your approved header and template.
- Define the outputsAdd three string outputs:
sms_status,sms_message_idandsms_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-43210into9876543210, 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-Keyheader from the secret. - It gives up after 15 seconds. HubSpot stops custom code after 20 seconds and 128 MB of memory.
- On
429or a5xxerror 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 intosms_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 field | HubSpot value | Rules |
|---|---|---|
sender_id | Static value, e.g. ACMEIN | Required. An approved DLT header on your account, up to 11 characters (headers are 6). |
recipient | Mobile phone number (mobilephone) or Phone number (phone) | Required. 9876543210 or +919876543210. No spaces, dashes or brackets. |
message | Static text (webhook) or text built in code | Required. Up to 1,600 characters, and it must match an approved template. |
dlt_template_id | Static value | Optional. It must reach us as text. If you get "must be a string", leave it out. |
route | transactional or promotional | Optional. 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
- Set up the key firstUse the HubSpot-only key, with HubSpot's ranges already in its list.
- 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. - 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.
- Check the resultRead the outputs or the Response tab in HubSpot, and the SMS log in your OnlineSMSService dashboard.
- 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
401or403errors first.
Troubleshooting
| Response | Cause | Fix |
|---|---|---|
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 recipient | The 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_MISMATCH | The 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 seconds | HubSpot'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.