Description
n8n-nodes-context-sms
A custom n8n node for integrating with Sabrhub SMS API. This node allows you to send SMS messages through your n8n workflows using the Sabrhub messaging platform.
Features
- Send SMS Messages: Send text messages to any phone number
- Environment Support: Switch between production and development environments
- API Key Authentication: Secure authentication using API keys
- Error Handling: Comprehensive error handling and validation
- Phone Number Validation: Automatic validation of phone number formats
Installation
From npm (Recommended)
npm install n8n-nodes-context-sms
From source
- Clone this repository
- Install dependencies:
npm install - Build the project:
npm run build
Usage
1. Add the Node to n8n
- In your n8n instance, go to Settings > Community Nodes
- Click "Install a community node"
- Enter the package name:
n8n-nodes-context-sms - Click "Install"
Alternatively, if you have n8n installed locally:
npm install n8n-nodes-context-sms
2. Configure Credentials
- Create a new workflow or open an existing one
- Add the "Context SMS" node to your workflow
- Click on the node and go to the "Credentials" tab
- Create new credentials with the following information:
- API Key: Your Sabrhub API key (e.g.,
mx_dffb6a98dc315076bbe590244f779ecd_17606086476322) - Environment: Choose between Production or Development
- Production URL:
https://context-sms.sabrhub.com(default) - Development URL:
https://teams-dev-backend.sabrhub.com(default)
- API Key: Your Sabrhub API key (e.g.,
3. Configure the Node
- Select the "SMS" resource
- Choose the "Send" operation
- Fill in the required fields:
- To Number: Recipient's phone number (e.g.,
+12067452650) - From Number: Sender's phone number (e.g.,
+17373138331) - Message Text: The SMS content
- To Number: Recipient's phone number (e.g.,
4. Example Workflow
Here's a simple example workflow that sends an SMS when triggered:
{
"nodes": [
{
"parameters": {},
"id": "webhook-trigger",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [240, 300]
},
{
"parameters": {
"resource": "sms",
"operation": "send",
"toNumber": "={{$json.phone}}",
"fromNumber": "+17373138331",
"messageText": "Hello! This is a test message from n8n."
},
"id": "sabrhub-sms",
"name": "Send SMS",
"type": "n8n-nodes-context-sms.sabrhub",
"typeVersion": 1,
"position": [460, 300],
"credentials": {
"sabrhubApi": {
"id": "your-credential-id",
"name": "Sabrhub API"
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Send SMS",
"type": "main",
"index": 0
}
]
]
}
}
}
API Reference
Sabrhub SMS API
The node integrates with the Sabrhub SMS API endpoint:
- Production:
https://context-sms.sabrhub.com/outbound/send-sms - Development:
https://teams-dev-backend.sabrhub.com/outbound/send-sms
Request Format
{
"toNumber": "string",
"messageText": "string",
"fromNumber": "string"
}
Headers
Content-Type: application/jsonX-API-Key: your-api-key
Development
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- n8n instance for testing
Setup
-
Clone the repository:
git clone https://github.com/sabrhub/n8n-nodes-context-sms.git cd n8n-nodes-context-sms -
Install dependencies:
npm install -
Build the project:
npm run build
Testing
-
Start your n8n instance in development mode:
n8n start --tunnel -
Install the node locally:
npm run build # Copy the dist folder to your n8n community nodes directory -
Test the node in your n8n workflow
Scripts
npm run build– Build the TypeScript filesnpm run dev– Watch mode for developmentnpm run lint– Run ESLintnpm run format– Format code with Prettier
Error Handling
The node includes comprehensive error handling:
- Phone Number Validation: Ensures phone numbers start with
+ - Required Field Validation: Validates all required fields are provided
- API Error Handling: Handles API errors gracefully
- Continue on Fail: Option to continue workflow execution on errors
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add some amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
License
This project is licensed under the MIT License – see the LICENSE file for details.
Support
For support and questions:
- Create an issue on GitHub
- Contact Sabrhub support at support@sabrhub.com
- Check the Sabrhub API documentation
Changelog
1.0.0
- Initial release
- SMS sending functionality
- Environment support (production/development)
- API key authentication
- Phone number validation