Expertise technical

Integrating SMS sending in Odoo in Morocco: Complete guide (high demand locally)

Integrate SMS Odoo Morocco: Technical guide with code examples for developers in Morocco.

Integrating SMS sending in Odoo in Morocco: Complete guide (high demand locally)
Table of Contents
  1. Odoo has become the number one ERP of Moroccan SMEs (distributors, e-commerce, factories) thanks to its modularity and affordable entry cost. Once the entire management of the company is centralized on Odoo, a critical need emerges: to communicate with customers outside of email, which is too often ignored.
  2. Why Odoo is so widespread among Moroccan SMEs
  3. Method 1: Configuring the native Odoo SMS module with your provider
  4. Method 2: Automated Action (Webhook / Code Python)
  5. Cases of use: Automation of notifications (Invoices, Deliveries, RDV)
  6. Limitations of integration and when to call a developer

Odoo has become the number one ERP of Moroccan SMEs (distributors, e-commerce, factories) thanks to its modularity and affordable entry cost. Once the entire management of the company is centralized on Odoo, a critical need emerges: to communicate with customers outside of email, which is too often ignored.

Integrating a Sovereign Moroccan SMS API (such as EnvoiSMS) into your Odoo instance (V15, V16, V17) makes it possible to automate delivery tracking, invoice collection, or business rebounds.

Why Odoo is so widespread among Moroccan SMEs

The Moroccan market has long been dominated by disparate management software (a software for the compta, an Excel file for the stock). Odoo has unified all of this. However, Odoo’s native “SMS Marketing” module often poses problems in Morocco: - It uses international IAP (In-App Purchases) routes by default (often expensive to +212). - It does not handle the Sender ID Alphanumérique localized. - There is a lack of compliance with the Moroccan CNDP (the numbers start on foreign servers).

Connect your own Moroccan SMS gateway via the EnvoiSMS API to Odoo.

Method 1: Configuring the native Odoo SMS module with your provider

If you use Odoo Studio or have access to technical settings, you can overload the Odoo SMS gateway.

  1. Go to ‘Settings’ > ‘Technique’ > ‘SMS Passes’ (Activate developer mode).
  2. Create a new gateway pointing to the EnvoiSMS API URL: https://api.envoisms.ma/v1/messages.
  3. In the header configuration, add your API key: Authorization: Bearer YOUR_TOKEN.
  4. Mapp the settings for the POST query (the destination number to and the message).
  • Advantage:* You continue to use the native "Send SMS" buttons on the Odoo interface.

Method 2: Automated Action (Webhook / Code Python)

This is the preferred method of Moroccan Odoo integrators for complex automations (e.g., "Send a SMS as soon as a Delivery Coupon is validated").

In 'Automated Actions', create a rule on the 'stock.picking' template. Select the action "Execute Python code".

python
import requests
import json

# Variables Odoo
client_phone = record.partner_id.mobile
order_name = record.origin

if client_phone:
    url = "https://api.envoisms.ma/v1/messages"
    payload = json.dumps({
      "from": "MA_SOCIETE",
      "to": client_phone,
      "message": f"Bonjour, votre commande {order_name} est en route !"
    })
    headers = {
      'Authorization': 'Bearer VOTRE_API_KEY',
      'Content-Type': 'application/json'
    }
    
    # Envoi asynchrone pour ne pas bloquer l'interface Odoo
    requests.request("POST", url, headers=headers, data=payload, timeout=5)

Cases of use: Automation of notifications (Invoices, Deliveries, RDV)

Once the integration is successful, here are the 3 most cost-effective automations for a Moroccan SME:

  1. Invoicing Module: Create a scheduled action (Cron) that detects invoices that have been due for 5 days. "Remember: Your invoice F-2026/145 has arrived at due date. please proceed with the settlement." -> Dramatically reduces payment delays.
  1. E-commerce tracking (Sales & Inventory Module): The e-commerce customer’s fear in Morocco is the lack of tracking.A SMS sent as soon as the status changes to “Ready to be shipped” reduces customer service calls.
  1. Termin reminders (Calendar/Services module): For service providers, send a SMS to H-24 before the intervention (e.g. air conditioning installation).

Limitations of integration and when to call a developer

If your Odoo stream exceeds 10,000 SMS per day, avoid “Automatic Actions” with synchronous Python code (which may slow down your Odoo server workers). Call a Odoo integration partner to create a custom module (Custom Addon) that will manage SMS sending in the background via an asynchronous wait line (Celery/Job Queue) coupled with the API EnvoiSMS. You will thus combine the robustness of the ERP with the deliverability of local routes to Moroccan operators.

Why choose EnvoiSMS for your business?

Carrier Delivery

Local routes to IAM, Orange and Inwi, with automatic failover between routes and delivery status sent by webhook.

Cost Optimization

WhatsApp Business API from 0.65 MAD per message with optimal ROI.

Sovereign Data (CNDP)

Full compliance with Moroccan personal data protection regulations (CNDP).

How do I track routing on the IAM, Inwi and Orange networks?
Our local routes to Maroc Telecom (IAM), Orange and inwi, with automatic failover between routes, return a carrier delivery status for every message, by webhook. Delivery time depends on the recipient's carrier and network.
How does the platform manage the format of Moroccan numbers?
EnvoiSMS automatically normalizes the numbers entered (06..., 07..., 00212...) to the E.164 standard (+212) to avoid any delivery failure.

Suggested Articles

SMS Formatting in Morocco: Line Breaks, GSM-7 vs UCS-2 Encoding and Cost Optimization
technical

SMS Formatting in Morocco: Line Breaks, GSM-7 vs UCS-2 Encoding and Cost Optimization

WhatsApp Business Formatting in Morocco: Enriched Text, Emojis and Interactive Buttons
technical

WhatsApp Business Formatting in Morocco: Enriched Text, Emojis and Interactive Buttons

One-Tap Autofill & 1-Click WhatsApp OTP Authentication in Morocco
technical

One-Tap Autofill & 1-Click WhatsApp OTP Authentication in Morocco