Odoo SMS Gateway Integration
Odoo is a popular open-source ERP/CRM platform. Odoo's native SMS functionality uses either its built-in IAP (In-App Purchase) service or direct Twilio integration. It does not natively expose a generic HTTP SMS gateway for custom providers.
To use SMSDESK as the SMS gateway, you need a third-party module that adds configurable HTTP SMS gateway support to Odoo. Popular options include:
- eis_sms_apis (Dynamic SMS Gateway) — allows defining custom REST endpoints
with user-configurable parameter names and placeholders like
{phone},{message},{api_key} - send_sms — community module that supports HTTP GET/POST gateways with
{mobile}and{message}placeholders - Custom modules — developers can build modules that call any HTTP endpoint
via Odoo's
requestsorurlliblibraries
- Install a third-party SMS gateway module (e.g.,
eis_sms_apis) in Odoo - Configure the module to point to this SMSDESK endpoint
- Map Odoo's SMS placeholders to SMSDESK parameter names
- Odoo sends SMS via HTTP GET/POST or JSON POST to SMSDESK
Endpoint
GET POST
https://{host}/api/http/odoo/main.ashx
https://desk.sms.com.na (SaaS),
https://sms.yourcompany.com (Enterprise OnSite)
Supports GET (query string), POST form-encoded, and
JSON POST (Content-Type: application/json). The handler
auto-detects the format.
Authentication
Pass your SMSDESK API key in the apikey or key parameter. This is
the same API key used across all SMSDESK integrations.
Getting Your API Key
- Log in to the SMSDESK Portal
- Navigate to your SMS Channel settings
- Copy your existing API key or generate a new one
Parameters
For form-encoded requests, parameters can be sent via query string (GET) or form body (POST). For JSON requests, send as a JSON object body.
| Parameter | Aliases | Required | Description |
|---|---|---|---|
apikey |
key |
Yes | Your SMSDESK API key |
number |
to, recipients, mobile,
phone
|
Yes | Recipient phone number(s), comma-separated for multiple |
message |
text, msg |
Yes | SMS message text |
from |
— | No | Sender ID (ignored, uses default channel) |
sms_pid |
ref |
No | Optional Odoo SMS track ID for reference |
format |
— | No | Set to json to force JSON response format (GET only) |
mobile and phone
aliases? Different Odoo community modules use different placeholder names for the
recipient field. The send_sms module uses {mobile}, while
eis_sms_apis uses {phone}. This handler accepts both so you don't
need to worry about which module you're using.
Response Format
Plain Text (default for form-encoded)
12345:264811234567:PENDING,12346:264812345678:PENDING
JSON (with ?format=json or JSON POST)
{
"status": "ok",
"messages": [
{ "sms_id": "12345", "recipient": "264811234567", "status": "PENDING" }
]
}
Error (plain text)
ERROR: [apikey] or [key] NOT PROVIDED
Odoo SMS Gateway Configuration
Option 1: Using eis_sms_apis Module (Recommended)
The eis_sms_apis (Dynamic SMS Gateway) module is a popular Odoo community module
that allows configuring custom HTTP SMS gateways with user-defined parameter mappings.
- Install the
eis_sms_apismodule in Odoo (available from Odoo Apps store) - Enable Developer Mode (Settings → scroll to bottom → Activate Developer Mode)
- Navigate to Settings → Technical → SMS / Phone → SMS Gateways
- Click Create and configure:
- Name: SMSDESK
- Base URL:
https://{host}/api/http/odoo/main.ashx - HTTP Method: POST (Form Data) or GET
- Auth Type: API Key
- Parameter Mapping:
Param Type Placeholder Map To Number {phone}phoneMessage {message}messageAuth {api_key}apikey - API Key Value: Your SMSDESK API key
- Save and send a test SMS
Option 2: Using send_sms Community Module
The send_sms module uses {mobile} as the recipient placeholder.
- Install the
send_smsmodule from Odoo Apps - Navigate to SMS Gateway settings
- Configure:
- Gateway URL:
https://{host}/api/http/odoo/main.ashx - Method: POST or GET
- Parameters:
mobile={mobile}message={message}apikey= your SMSDESK API key
- Gateway URL:
- Save and test
Option 3: Custom Odoo Module
If you have a custom Odoo module, use Odoo's requests library to call the
SMSDESK endpoint directly:
import requests
class SmsSms(models.Model):
_inherit = 'sms.sms'
def _send_sms(self, numbers, message):
url = "https://{host}/api/http/odoo/main.ashx"
params = {
"apikey": "your-smsdesk-api-key",
"number": ",".join(numbers),
"message": message,
}
response = requests.post(url, data=params)
return response.text
Code Examples
cURL (GET - form mode)
curl "https://{host}/api/http/odoo/main.ashx?apikey=your-api-key&phone=264811234567&message=Your+order+SO001+is+confirmed"
cURL (POST - form mode)
curl -X POST "https://{host}/api/http/odoo/main.ashx" \
-d "apikey=your-api-key&mobile=264811234567&message=Your order SO001 is confirmed&sms_pid=SO001"
cURL (POST - JSON mode)
curl -X POST "https://{host}/api/http/odoo/main.ashx" \
-H "Content-Type: application/json" \
-d '{
"apikey": "your-api-key",
"number": "264811234567",
"message": "Your order SO001 is confirmed and will be shipped tomorrow.",
"sms_pid": "SO001"
}'
Python (Form-encoded mode)
import requests
# Form-encoded mode (typical Odoo gateway call)
url = "https://{host}/api/http/odoo/main.ashx"
data = {
"apikey": "your-api-key",
"phone": "264811234567", # eis_sms_apis uses 'phone' placeholder
"message": "Your order SO001 is confirmed.",
"sms_pid": "SO001"
}
response = requests.post(url, data=data)
print(response.text)
# Output: 12345:264811234567:PENDING
Python (JSON mode)
import requests
url = "https://{host}/api/http/odoo/main.ashx"
headers = {"Content-Type": "application/json"}
data = {
"apikey": "your-api-key",
"number": "264811234567,264812345678",
"message": "Stock alert: Product XYZ is running low.",
"sms_pid": "STOCK-ALERT-001"
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
# {"status": "ok", "messages": [{"sms_id": "12345", "recipient": "264811234567", "status": "PENDING"}, ...]}
PHP
<?php
$url = "https://{host}/api/http/odoo/main.ashx";
$data = http_build_query([
"apikey" => "your-api-key",
"mobile" => "264811234567", // send_sms module uses 'mobile'
"message" => "Your invoice INV/2026/001 is ready. Amount: N$ 3,450.00",
"sms_pid" => "INV-001"
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
// Output: 12345:264811234567:PENDING
?>
Odoo Custom Module (Python)
from odoo import models, api
import requests
class SmsSms(models.Model):
_inherit = 'sms.sms'
@api.model
def _send_sms_via_smsdesk(self, numbers, message):
"""Send SMS via SMSDESK gateway endpoint."""
url = "https://{host}/api/http/odoo/main.ashx"
params = {
"apikey": self.env['ir.config_parameter'].sudo().get_param('smsdesk.api_key'),
"number": ",".join(numbers),
"message": message,
}
response = requests.post(url, data=params, timeout=30)
return response.text
def action_send_sms(self):
"""Override to use SMSDESK instead of IAP/Twilio."""
numbers = [r.mobile for r in self.partner_ids if r.mobile]
message = self.body
result = self._send_sms_via_smsdesk(numbers, message)
# Parse result: "12345:264811234567:PENDING"
for line in result.split(','):
parts = line.split(':')
if len(parts) >= 3:
sms_id, recipient, status = parts[0], parts[1], parts[2]
self._update_sms_status(sms_id, status)
Official References
- Odoo SMS Marketing Documentation: odoo.com/documentation/sms_configuration — Covers IAP and Twilio setup for native SMS
- Odoo Twilio Integration: odoo.com/documentation/twilio — How to configure Twilio as SMS provider in Odoo
- Odoo Apps Store:
apps.odoo.com —
Search for "SMS gateway" to find third-party modules like
eis_sms_apis - Odoo Development Documentation: odoo.com/documentation/developer — For building custom SMS gateway modules
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
ERROR: [apikey] or [key] NOT PROVIDED |
API key parameter missing | Ensure apikey or key is in the request |
ERROR: [number] or [to] or [mobile] or [phone] ... |
Recipient parameter missing | Include number, to, recipients,
mobile, or phone
|
| Odoo test SMS fails silently | Incorrect parameter mapping in gateway module | Verify parameter names match: phone or mobile,
message, apikey
|
| No SMS Gateway option in Odoo settings | Missing third-party module | Install eis_sms_apis or send_sms from Odoo Apps.
Native Odoo SMS only supports IAP/Twilio |
0:{recipient}:ERROR |
Invalid API key or insufficient credits | Verify API key and SMS credit balance in SMSDESK Portal |
| SSL error from Odoo server | Odoo server using outdated TLS | Ensure Odoo server supports TLS 1.2+ (Python 3.6+ or Ubuntu 18.04+) |
| JSON response expected but got plain text | Content-Type not set to application/json | Set Content-Type: application/json header or add
?format=json
|
