Quickstart Guide: Bonrix SMS Server 4 HTTP API IntegrationThis guide walks you through integrating with the Bonrix SMS Server 4 HTTP API. It covers installation prerequisites, API endpoints, authentication, sending messages, delivery reports, handling errors, sample requests for common languages, and best practices for production use.
What is Bonrix SMS Server 4 HTTP API?
Bonrix SMS Server 4 HTTP API is an HTTP-based interface that allows applications to send SMS messages via a Bonrix SMS Gateway. It supports sending single or bulk messages, receiving delivery reports, and basic account management functions over standard HTTP(S) requests.
Prerequisites
- A running Bonrix SMS Server 4 instance (Windows Server).
- HTTP API enabled in the Bonrix server configuration.
- A valid API username and password or API key provided by the Bonrix admin.
- Network access from your application to the Bonrix server (open port, typically 80 or 8080 for HTTP; 443 for HTTPS).
- Basic knowledge of making HTTP requests from your chosen programming language.
API Overview
Bonrix HTTP API typically exposes endpoints that accept GET or POST requests with query parameters or form-encoded bodies. Common operations include:
- Sending SMS messages (single or bulk)
- Checking message status / delivery reports
- Managing sender IDs or accounts (depending on server configuration)
Endpoint base URL example: https://your-bonrix-server:port/http-api
Note: Replace with your actual server host, port, and context path.
Authentication
Bonrix often uses simple authentication via username and password passed as query parameters (or via HTTP Basic Auth if configured). Example parameter names commonly used:
- username
- password
- api_key (if configured)
Security recommendation: Use HTTPS and prefer API keys or token-based auth when available.
Sending SMS — Parameters
Typical parameters for sending an SMS:
- username (or api_key) — your account identifier
- password — your account password (if required)
- to — recipient phone number in international format (e.g., +1234567890)
- from — sender ID (alphanumeric or numeric, depending on gateway allowed formats)
- msg — message text (URL-encoded if using GET)
- concat — flag for concatenation/long messages (server may auto-handle)
- unicode — flag (1 or true) to send Unicode (UTF-8) messages such as non-Latin scripts
- dlr — delivery report callback URL (optional)
- priority — optional priority flag
Exact parameter names may vary; check your server’s HTTP API documentation or admin settings.
Example Requests
Below are concise examples for common environments. Adjust host, port, credentials, and parameters as needed.
Curl (GET)
curl -G "https://your-bonrix-server:8080/http-api/send" --data-urlencode "username=youruser" --data-urlencode "password=yourpass" --data-urlencode "to=+15551234567" --data-urlencode "from=MyCompany" --data-urlencode "msg=Hello%20from%20Bonrix%20SMS%20Server%204"
Curl (POST, form)
curl -X POST "https://your-bonrix-server:8080/http-api/send" -d "username=youruser" -d "password=yourpass" -d "to=+15551234567" -d "from=MyCompany" -d "msg=Hello from Bonrix SMS Server 4"
Python (requests)
import requests url = "https://your-bonrix-server:8080/http-api/send" payload = { "username": "youruser", "password": "yourpass", "to": "+15551234567", "from": "MyCompany", "msg": "Hello from Bonrix SMS Server 4" } resp = requests.post(url, data=payload, timeout=10) print(resp.status_code, resp.text)
Node.js (axios)
const axios = require('axios'); axios.post('https://your-bonrix-server:8080/http-api/send', new URLSearchParams({ username: 'youruser', password: 'yourpass', to: '+15551234567', from: 'MyCompany', msg: 'Hello from Bonrix SMS Server 4' })) .then(res => console.log(res.status, res.data)) .catch(err => console.error(err.response ? err.response.data : err.message));
Delivery Reports (DLR)
To receive delivery reports, include a dlr parameter pointing to an endpoint on your server. Bonrix will make an HTTP request to that URL when message status changes.
Typical DLR parameters sent to your callback:
- messageid — provider-assigned message ID
- to — recipient number
- status — delivery status (DELIVERED, FAILED, EXPIRED, etc.)
- timestamp — time of status update
Example DLR callback handling (Python Flask):
from flask import Flask, request app = Flask(__name__) @app.route('/sms/dlr', methods=['GET', 'POST']) def dlr(): data = request.values.to_dict() # Save data to DB or update message status return "OK", 200
Parsing Responses
Bonrix responses are usually plain text or simple key=value pairs. Example response formats:
- SUCCESS: messageid=12345
- ERROR: code=401&message=Authentication%20Failed
Always check HTTP status codes and parse response body accordingly.
Error Handling & Troubleshooting
- 401 / authentication errors: verify username/password and API settings.
- 400 / bad request: check required parameters and encoding (especially for msg).
- 500 / server error: check Bonrix server logs.
- Message not delivered: verify recipient number format, sender ID rules, and destination operator restrictions.
Enable verbose logging on both client and Bonrix server during integration testing.
Rate Limiting & Throttling
Bonrix may enforce rate limits per account. Implement request queuing, exponential backoff, and retries for transient failures. Use batching where supported.
Security Best Practices
- Use HTTPS for all API calls.
- Avoid sending credentials in URLs (prefer POST or headers).
- Restrict DLR endpoint to known IPs or use verification tokens.
- Rotate API credentials periodically.
Sample Integration Flow
- Configure Bonrix HTTP API and create API credentials.
- Test basic send with curl.
- Implement send function in your application.
- Set up DLR endpoint and test delivery reports.
- Handle errors, logging, and retries.
- Move to production with monitoring and credential rotation.
Best Practices & Tips
- Use international E.164 format for numbers (+countrycode…).
- Test Unicode messages separately (set unicode flag).
- Keep messages under SMS length limits or enable concatenation.
- Monitor delivery rates and server health.
- Maintain mapping between your internal message IDs and Bonrix messageid for reconciliation.
Appendix — Common Parameter Reference
Parameter | Description |
---|---|
username | API username |
password | API password |
api_key | Alternative API key (if supported) |
to | Recipient number (E.164) |
from | Sender ID |
msg | Message text |
unicode | Send as Unicode (1 or true) |
dlr | Delivery report callback URL |
priority | Message priority flag |
If you want, I can provide a full production-ready code sample for a specific language (Java, PHP, C#, Go) or help draft tests and monitoring for your integration.
Leave a Reply