Expertise developer

Morocco SMS API: Complete Integration Guide (2026)

Technical guide for integrating EnvoiSMS REST API with local routes to IAM, Inwi, and Orange in Morocco.

Morocco SMS API: Complete Integration Guide (2026)

1. Telecom Infrastructure and Carrier Routing in Morocco

Connecting to Moroccan mobile networks requires understanding the local telecom topography. The three licensed MNOs—Maroc Telecom (IAM), Orange Maroc, and Inwi—serve over 50 million active mobile lines. Utilizing legitimate local routes via EnvoiSMS.ma, with automatic failover between routes, keeps latency minimal (under 3 seconds) and avoids unreliable international gray routes.

2. Phone Number Formatting and E.164 Normalization (+212)

Moroccan mobile numbers use the +212 country code followed by a 9-digit subscriber number starting with 6 or 7 (e.g., +212 6XX-XXXXXX or +212 7XX-XXXXXX). The EnvoiSMS API automatically sanitizes localized formats (06..., 07..., 00212...) to ensure reliable delivery and prevent credit loss on malformed requests.

3. REST API Architecture and Outbound Payloads

EnvoiSMS provides an intuitive REST interface at https://api.envoisms.ma/v1/messages. You authenticate requests using a bearer API key (env_live_...) in the HTTP Authorization header. Outbound payloads accept JSON containing recipient numbers, message body, channel selection (sms, whatsapp_direct, waba), and optional custom sender IDs.

4. Webhook Deliverability Reports (DLR) and HMAC Security

Delivery receipts are dispatched via asynchronous HTTP POST webhooks to your callback URL. Each delivery report contains standard status events (sent, delivered, failed) and is cryptographically signed with an HMAC-SHA256 signature, enabling your server to verify payload authenticity before updating local database records.

5. Production Best Practices, Sandbox Testing, and Cost Controls

Before deploying to live traffic, developers can test workflows against our sandbox environment (is_sandbox: true). EnvoiSMS enforces dual-currency balances (MAD / EUR at an 11.0 fixed rate) with per-SMS pricing from 0.48 MAD (Enterprise plan, validated Sender ID) to 0.792 MAD (shared sender) depending on your plan and Sender ID, providing full financial predictability.

💡 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).

Q.What is the average SMS delivery latency in Morocco?
EnvoiSMS local routes deliver transactional SMS within 2 to 5 seconds across IAM, Orange, and Inwi.
Q.How do I verify webhook delivery authenticity?
EnvoiSMS includes an `X-EnvoiSMS-Signature` header containing an HMAC-SHA256 hash of the payload computed with your webhook secret.
Q.Are test credits available for sandbox validation?
Yes, new developer accounts receive sandbox test credentials to validate API integration before topping up.

Suggested Articles

Laravel SMS Notification Channel for Morocco: Complete Guide
developer

Laravel SMS Notification Channel for Morocco: Complete Guide

Inbound Webhooks: Connect TikTok & Meta Lead Ads Directly to WhatsApp for Instant Conversion
developer

Inbound Webhooks: Connect TikTok & Meta Lead Ads Directly to WhatsApp for Instant Conversion

WhatsApp Flows: Native In-Chat Forms for COD Order Verification in Morocco
developer

WhatsApp Flows: Native In-Chat Forms for COD Order Verification in Morocco