Send SMS to Morocco: Complete Guide to ANRT Compliance & Sender ID Registration
Complete guide to sending SMS in Morocco: ANRT sender ID registration (3-week timeline), Law 09-08 compliance, carrier requirements for Maroc Telecom, Orange, Inwi, and API integration.
Send SMS to Morocco by meeting strict ANRT regulatory and technical requirements across three major carriers. This guide shows you how to send compliant SMS messages to Moroccan customers in 2024, covering sender ID registration (3-week timeline), Law 09-08 data protection compliance, CNDP requirements, carrier-specific technical specs for Maroc Telecom, Orange Morocco, and Inwi, and API integration with Twilio, Sinch, MessageBird, and Plivo.
Morocco SMS Market Overview
Property
Value
Locale name
Morocco
ISO code
MA
Region
Middle East & Africa
Mobile Country Code (MCC)
604
Dialing Code
+212
Market Conditions: Morocco operates a vibrant mobile communications market with approximately 49.2 million subscribers and a penetration rate of 137.5% (as of 2024). Three major operators serve the market: Maroc Telecom (34–38% market share), Orange Morocco (33–34% market share), and Inwi (formerly Wana, 31–32% market share). SMS remains a crucial communication channel for businesses and consumers, though WhatsApp and Facebook Messenger grow increasingly popular. Android devices dominate the market at approximately 85%, with iOS devices comprising the remaining share.
Practical Implications for SMS Senders: Test across all three carriers since sender ID preservation varies by operator (Inwi does not preserve alphanumeric sender IDs). Route SMS traffic through aggregators with direct connections to all three carriers for optimal delivery rates. The high market penetration (137.5%) means many users carry multiple SIM cards – handle number portability properly in your delivery infrastructure.
SMS Features and Capabilities in Morocco
Morocco supports concatenated messages and alphanumeric sender IDs but limits two-way SMS functionality.
Two-Way SMS Support
Status: Not supported
You cannot receive replies to SMS messages through most providers in Morocco. Standard A2P (Application-to-Person) channels do not support two-way SMS.
Workarounds for Two-Way Communication:
WhatsApp Business API: Enables full two-way messaging with rich media support; widely used in Morocco (source: Twilio Morocco Guidelines)
RCS Business Messaging: Available on Android devices (85% of Morocco's market); supports read receipts, typing indicators, and interactive buttons
Web-based response portals: Include a shortened URL in SMS directing users to a web form or chat widget for responses
Voice callback systems: Provide a phone number for users to call for customer service or feedback
Email follow-up: Include an email address for detailed responses to transactional or support messages
Concatenated Messages (Segmented SMS)
Status: Yes, supported across most networks (may vary by sender ID type)
Message Length Rules:
GSM-7 encoding: 160 characters per segment
Unicode (UCS-2) encoding: 70 characters per segment
Arabic text: Requires UCS-2 encoding, limited to 70 characters per segment
Encoding: Morocco supports both GSM-7 and UCS-2 encodings. Arabic text requires UCS-2 encoding, reducing the character limit to 70 per segment.
Concatenation Cost Example: A 200-character English message (GSM-7) splits into 2 segments (153 characters each due to concatenation headers), costing 2× the single-segment rate. A 150-character Arabic message (UCS-2) splits into 3 segments (67 characters each), costing 3× the rate. Always calculate segment costs before large campaigns.
MMS Support
Status: Not directly supported – converted to SMS with URL
Morocco does not support MMS messages directly. When you send MMS, carriers automatically convert the message to SMS with an embedded URL link where recipients view the multimedia content. This ensures delivery while maintaining compatibility across all networks.
Recipient Phone Number Compatibility
Number Portability
Status: Fully available
Morocco offers number portability, allowing users to keep phone numbers when switching mobile operators. Messages route properly to the current carrier without significantly impacting SMS delivery or routing.
Can You Send SMS to Landlines in Morocco?
Status: Not supported
You cannot send SMS to landline numbers in Morocco. Sending to landlines results in delivery failure, typically generating a 400 response with error code 21614. Failed attempts do not appear in logs and do not charge your account.
Morocco SMS Compliance: ANRT Regulations and Law 09-08 Requirements
The National Telecommunications Regulatory Agency (ANRT) regulates SMS communications in Morocco. Comply with local telecommunications laws and data protection regulations.
Primary Legislation: Morocco's data protection framework operates under Law No. 09-08 (dated February 18, 2009) relating to protection of individuals with regard to personal data processing, and its implementation Decree No. 2-09-165 (dated May 21, 2009). The Commission nationale de contrôle de la protection des données à caractère personnel (CNDP) implements and enforces the law.
2019 ANRT Opt-Out Policy: In 2019, ANRT introduced an opt-out policy for SMS marketing with third-party providers, requiring Maroc Telecom, Orange Morocco, and Inwi to improve customer protection through standardized opt-out mechanisms.
2025 Equipment Regulation Update: On January 20, 2025, ANRT issued Decision ANRT/DG/N°16/24, updating type approval and labeling requirements for telecommunications equipment, effective May 1, 2025.
SMS Marketing Consent Requirements in Morocco (Law 09-08)
Explicit Consent Requirements:
Obtain clear, documented opt-in consent before sending marketing messages
Maintain detailed records of when and how you obtained consent
Include your company name and purpose in consent requests
Provide clear terms about message frequency and content
Process personal data fairly and lawfully for specific purposes
Penalties for Non-Compliance: Under Law No. 09-08, violations are punishable by:
Fines for entities: 10,000 to 100,000 MAD (~$1,000 to $10,000 USD)
Fines for responsible persons: 20,000 to 200,000 MAD (~$2,000 to $20,000 USD)
Additional penalties: Imprisonment of 3 months to 4 years for severe violations
Use double opt-in verification for marketing lists
Document consent timestamp, source, and IP address
Store consent records for at least 2 years
Maintain and update your consent database regularly
Obtain prior CNDP authorization for international data transfers
Sample Compliant Opt-In Language:
English: "By checking this box, I consent to receive promotional SMS from [Company Name] about [purpose]. You may receive up to 4 messages per month. Reply STOP to unsubscribe. Message rates may apply."
French: "En cochant cette case, je consens à recevoir des SMS promotionnels de [Nom de l'entreprise] concernant [objectif]. Vous pouvez recevoir jusqu'à 4 messages par mois. Répondez ARRET pour vous désabonner."
Arabic: "بتحديد هذا المربع، أوافق على تلقي رسائل SMS ترويجية من [اسم الشركة] حول [الغرض]. قد تتلقى ما يصل إلى 4 رسائل شهريًا. أرسل إيقاف لإلغاء الاشتراك."
HELP/STOP and Other Commands
Required Features:
Support standard opt-out keywords in all campaigns:
STOP, ARRET, UNSUBSCRIBE (English/French)
إيقاف (Arabic – "STOP" in Arabic)
Provide service information through HELP/AIDE commands
Respond to commands in the same language as the keyword
Provide all command responses free of charge
Process opt-out requests within 24 hours (ANRT requirement)
Do Not Call / Do Not Disturb Registries
Status: No centralized registry
Morocco does not maintain a centralized Do Not Call registry. You must:
Maintain your own suppression lists
Honor opt-out requests within 24 hours
Clean contact lists regularly
Implement automated opt-out processing
Document all opt-out requests and processing dates
Best Times to Send SMS in Morocco (UTC+1 Timezone & Prayer Times)
Morocco Time Zone: Morocco observes Western European Time (WET/UTC+0) as its base time zone but operates on permanent Daylight Saving Time (UTC+1/WEST) for most of the year. During Ramadan, the country temporarily reverts to UTC+0. Understanding Morocco's timezone is crucial for SMS delivery optimization and compliance with ANRT sending guidelines.
Time Zone Identifier: Africa/Casablanca (IANA)
Recommended SMS Sending Hours:
Standard: 9:00 AM to 8:00 PM Morocco local time (UTC+1)
Religious Considerations: Avoid prayer times (particularly Friday Jumu'ah prayers)
Ramadan Awareness: Adjust for time zone change during Ramadan (UTC+0)
Holiday Respect: Avoid Ramadan and other religious observances
Monitor delivery reports for sender ID preservation
Required Information:
Sender ID (up to 11 characters, alphanumeric only)
SMS type (OTP or Marketing)
SMS content with URL links (if applicable)
Registration Costs: Fees vary by provider:
Twilio: Included in platform fees; no separate sender ID registration charge for Morocco
Plivo: One-time $25 USD setup fee per sender ID
Sinch: No registration fee for most countries including Morocco; check dashboard for current pricing
MessageBird: Contact sales for Morocco-specific pricing
Note: Fees are subject to change; confirm current pricing with your SMS provider before registration.
Sender ID Preservation: Yes, preserved across all networks except Inwi
Character Limits: Up to 11 characters (letters and numbers only)
Content Restrictions: No political, religious, unsolicited promotion, or gambling content; P2P traffic prohibited
Long Codes
Support:
Domestic long codes: Not supported
International long codes: Supported with limitations
Numeric sender IDs: Not supported by Maroc Telecom and Wana Telecom
Sender ID Preservation: No, international numbers may be overwritten with generic alphanumeric IDs
Use Cases: Not recommended for marketing campaigns; better suited for transactional messages
Short Codes
Status: Not currently supported in Morocco
Alternative: Use pre-registered alphanumeric sender IDs instead
Restricted SMS Content and Carrier Filtering in Morocco
Prohibited Content:
Gambling and betting services
Adult content or explicit material
Political messaging without proper authorization
Religious content
Illegal substances or services
Hate speech or discriminatory content
Regulated Industries and Additional Documentation Requirements:
Financial services: Require business license verification, proof of financial institution registration, and sample message templates showing compliance with banking regulations
Healthcare messages: Must include CNDP registration for health data processing under Law 09-08, patient consent documentation, and compliance with medical privacy standards
Debt collection services: Face strict limitations; require legal authorization, proof of debt ownership, and compliance with consumer protection laws
Telecommunications offers: May require ANRT pre-approval for promotional content
Submit documentation approval requests through your SMS provider with supporting legal documents. Approval typically adds 1–2 weeks to standard registration timelines.
How Do Moroccan Carriers Filter SMS Content?
Known Carrier Filters:
URLs from unknown domains may be blocked
Messages containing specific keywords related to restricted content
Multiple exclamation marks or all-caps text
P2P (Person-to-Person) traffic blocked
Best Practices to Avoid Filtering:
Use registered, approved sender IDs
Avoid URL shorteners
Keep content professional and clear
Use approved templates for sensitive industries
Maintain consistent sending patterns
Real-World Filtering Examples:
Messages with 3+ exclamation marks (e.g., "WIN NOW!!!") commonly blocked by Orange Morocco
Generic sender IDs like "INFO" or "SMS" prohibited by all carriers
URL shorteners (bit.ly, tinyurl) frequently filtered; use full branded domains
Plivo offers a reliable API with specific features for Morocco messaging.
TypeScript
import plivo from'plivo';
classPlivoSMSClient {
privateclient: any;
constructor(authId: string, authToken: string) {
this.client = new plivo.Client(authId, authToken);
}
asyncsendSMS(
to: string,
message: string,
senderId: string
): Promise<void> {
try {
const response = awaitthis.client.messages.create({
src: senderId, // Your registered sender IDdst: to, // Destination number in E.164 formattext: message,
// Morocco-specific parametersurl_strip_domain: false, // Preserve full URLspowerpack_id: 'your_powerpack_id'// If using Powerpack
});
console.log('Message sent:', response.messageUuid);
} catch (error) {
console.error('Plivo error:', error);
throw error;
}
}
}
API Rate Limits and Throughput
Default rate limits vary by provider:
Twilio: 100 messages/second
Sinch: 30 messages/second
MessageBird: 60 messages/second
Plivo: 50 messages/second
Strategies for Large-Scale SMS Sending:
Implement queue systems (Redis/RabbitMQ) for high-volume campaigns
Use batch APIs where available for improved throughput
Implement exponential backoff for retries on failed deliveries
Monitor throughput and adjust sending rates based on carrier delivery metrics
Requesting Rate Limit Increases: Most providers support rate limit increases for verified business accounts. Contact your provider's sales or support team with:
Current sending volume and patterns
Expected peak volumes
Business verification documents
Use case description
Typical approval time: 3–5 business days. Twilio and Sinch commonly approve increases to 200–500 msg/sec for high-volume senders.
Error Handling and Reporting
Implement comprehensive logging
Monitor delivery receipts
Track common error codes
Set up automated alerts for failure thresholds
Maintain error logs for compliance
Morocco-Specific Error Codes Summary:
Error Code
Provider
Meaning
Action Required
21612
Twilio
Sender ID not registered or invalid To/From combination
Register sender ID through Console
21614
Twilio
Cannot send to landline
Remove landline numbers from list
30007
Twilio
Message filtered by carrier
Review content for compliance
30008
Twilio
Invalid destination number
Validate E.164 format (+212...)
SENDER_ID_NOT_REGISTERED
Infobip
Unregistered sender ID
Complete sender ID registration
INVALID_DESTINATION
Multiple
Number format error or inactive
Validate number and check portability
Frequently Asked Questions About SMS in Morocco
Do I need to register my sender ID in Morocco?
Yes, Morocco requires pre-registration for alphanumeric sender IDs. The registration process takes approximately 3 weeks and requires you to specify your sender ID (up to 11 alphanumeric characters), SMS type (OTP or Marketing), and SMS content with any URL links. Sender IDs are preserved across all networks except Inwi.
What laws govern SMS marketing in Morocco?
Law No. 09-08 (dated February 18, 2009) governs SMS marketing in Morocco, relating to protection of individuals with regard to personal data processing, and its implementation Decree No. 2-09-165. The CNDP (Commission nationale de contrôle de la protection des données à caractère personnel) oversees enforcement. Obtain explicit opt-in consent before sending marketing SMS and honor opt-out requests within 24 hours per ANRT guidelines.
Do I need consent to send SMS marketing in Morocco?
Yes, obtain clear, documented opt-in consent before sending marketing messages in Morocco. Maintain detailed records of when and how you obtained consent, including consent timestamp, source, and IP address. Store consent records for at least 2 years and obtain prior authorization from CNDP for international data transfers.
Which mobile carriers operate in Morocco?
Morocco has three major mobile carriers: Maroc Telecom (34–38% market share), Orange Morocco (33–34% market share), and Inwi (formerly Wana, 31–32% market share) as of 2024. The market has approximately 49.2 million subscribers with a penetration rate of 137.5%. All three carriers support number portability, allowing users to keep their phone numbers when switching providers.
What time zone does Morocco use for SMS sending?
Morocco observes permanent Daylight Saving Time (UTC+1/WEST) for most of the year. During Ramadan, the country temporarily reverts to UTC+0 (Western European Time). The time zone identifier is Africa/Casablanca (IANA). Send SMS messages between 9:00 AM and 8:00 PM local time, avoiding prayer times (particularly Friday prayers) and religious observances.
What character encoding should I use for Arabic SMS in Morocco?
Use UCS-2 encoding for Arabic text in Morocco, which limits messages to 70 characters per segment. GSM-7 encoding supports 160 characters per segment but only works for standard Latin characters. Messages automatically use the appropriate encoding based on content. Ensure proper right-to-left (RTL) text handling for Arabic content.
How long does it take to start sending SMS in Morocco?
Starting to send SMS in Morocco requires approximately 3 weeks for alphanumeric sender ID registration with ANRT. Provide your sender ID (up to 11 characters), specify SMS type (OTP or Marketing), and submit SMS content with any URL links. International long codes are supported but may be overwritten with generic alphanumeric IDs. Short codes are not currently available in Morocco.
What content is prohibited in SMS messages to Morocco?
Morocco prohibits gambling and betting services, adult content, political messaging without authorization, religious content, illegal substances, and hate speech in SMS messages. Financial services require additional documentation, healthcare messages must comply with Law 09-08 privacy regulations, and debt collection services face strict limitations. Carriers may also block URLs from unknown domains and messages with excessive punctuation or all-caps text.
Provider-specific Morocco integration guides (available in each provider's developer documentation portal)
Frequently asked questions
Use a pre-registered alphanumeric sender ID and an SMS API like Twilio, Sinch, MessageBird, or Plivo. Ensure your messages comply with local regulations and best practices, such as obtaining opt-in consent and supporting Arabic script.
Alphanumeric sender IDs are preferred and fully supported. They require pre-registration, which takes about 3 weeks. Numeric sender IDs and short codes are not supported by major carriers like Maroc Telecom.
Two-way SMS is not fully supported through most providers, meaning businesses cannot typically receive replies to A2P messages via standard channels.
The recommended sending window is between 9:00 AM and 8:00 PM local time (WET/GMT+1). Avoid sending during prayer times, religious holidays like Ramadan, and Friday prayers out of respect for local customs.
No, sending SMS messages to landline numbers in Morocco is not possible and will result in delivery failure. Attempts to send to landlines typically return a 400 error with code 21614.
Standard SMS messages are limited to 160 characters for GSM-7 encoding or 70 characters for Unicode (UCS-2) encoding, which is required for Arabic text.
Obtain explicit opt-in consent, support opt-out keywords (STOP, ARRET, UNSUBSCRIBE, ????????), respect local time zones and customs, and avoid prohibited content such as gambling, adult material, and political messaging without authorization.
Pre-registration is required and takes approximately three weeks. Alphanumeric sender IDs are preserved across most networks, though not by Inwi.
Keep messages concise (under 160 characters), include a clear call to action, personalize content thoughtfully, maintain a consistent brand voice, and incorporate your company name.
MMS is not directly supported. When an MMS is sent, it's automatically converted to an SMS containing a URL where recipients can view the multimedia content.
Process opt-out requests within 24 hours, maintain a centralized opt-out database, and include clear opt-out instructions in every message.
Twilio, Sinch, MessageBird, and Plivo all offer APIs with features tailored for sending SMS in Morocco, including support for alphanumeric sender IDs and Unicode encoding.
Gambling, adult content, political messaging without authorization, religious content, illegal substances/services, and hate speech are all prohibited. Financial services and healthcare messages require additional documentation.
Use pre-registered sender IDs, avoid URL shorteners, use clear and professional language, and adhere to approved templates for sensitive industries like finance and healthcare. Maintain consistent sending patterns.
Limit messages to 4-5 per recipient per month. Space out bulk campaigns to avoid network congestion and monitor delivery rates closely.
Send SMS to Morocco by meeting strict ANRT regulatory and technical requirements across three major carriers. This guide shows you how to send compliant SMS messages to Moroccan customers in 2024, covering sender ID registration (3-week timeline), Law 09-08 data protection compliance, CNDP requirements, carrier-specific technical specs for Maroc Telecom, Orange Morocco, and Inwi, and API integration with Twilio, Sinch, MessageBird, and Plivo.
Morocco SMS Market Overview
Market Conditions: Morocco operates a vibrant mobile communications market with approximately 49.2 million subscribers and a penetration rate of 137.5% (as of 2024). Three major operators serve the market: Maroc Telecom (34–38% market share), Orange Morocco (33–34% market share), and Inwi (formerly Wana, 31–32% market share). SMS remains a crucial communication channel for businesses and consumers, though WhatsApp and Facebook Messenger grow increasingly popular. Android devices dominate the market at approximately 85%, with iOS devices comprising the remaining share.
Practical Implications for SMS Senders: Test across all three carriers since sender ID preservation varies by operator (Inwi does not preserve alphanumeric sender IDs). Route SMS traffic through aggregators with direct connections to all three carriers for optimal delivery rates. The high market penetration (137.5%) means many users carry multiple SIM cards – handle number portability properly in your delivery infrastructure.
SMS Features and Capabilities in Morocco
Morocco supports concatenated messages and alphanumeric sender IDs but limits two-way SMS functionality.
Two-Way SMS Support
Status: Not supported
You cannot receive replies to SMS messages through most providers in Morocco. Standard A2P (Application-to-Person) channels do not support two-way SMS.
Workarounds for Two-Way Communication:
Concatenated Messages (Segmented SMS)
Status: Yes, supported across most networks (may vary by sender ID type)
Message Length Rules:
Encoding: Morocco supports both GSM-7 and UCS-2 encodings. Arabic text requires UCS-2 encoding, reducing the character limit to 70 per segment.
Concatenation Cost Example: A 200-character English message (GSM-7) splits into 2 segments (153 characters each due to concatenation headers), costing 2× the single-segment rate. A 150-character Arabic message (UCS-2) splits into 3 segments (67 characters each), costing 3× the rate. Always calculate segment costs before large campaigns.
MMS Support
Status: Not directly supported – converted to SMS with URL
Morocco does not support MMS messages directly. When you send MMS, carriers automatically convert the message to SMS with an embedded URL link where recipients view the multimedia content. This ensures delivery while maintaining compatibility across all networks.
Recipient Phone Number Compatibility
Number Portability
Status: Fully available
Morocco offers number portability, allowing users to keep phone numbers when switching mobile operators. Messages route properly to the current carrier without significantly impacting SMS delivery or routing.
Can You Send SMS to Landlines in Morocco?
Status: Not supported
You cannot send SMS to landline numbers in Morocco. Sending to landlines results in delivery failure, typically generating a 400 response with error code 21614. Failed attempts do not appear in logs and do not charge your account.
Morocco SMS Compliance: ANRT Regulations and Law 09-08 Requirements
The National Telecommunications Regulatory Agency (ANRT) regulates SMS communications in Morocco. Comply with local telecommunications laws and data protection regulations.
Primary Legislation: Morocco's data protection framework operates under Law No. 09-08 (dated February 18, 2009) relating to protection of individuals with regard to personal data processing, and its implementation Decree No. 2-09-165 (dated May 21, 2009). The Commission nationale de contrôle de la protection des données à caractère personnel (CNDP) implements and enforces the law.
2019 ANRT Opt-Out Policy: In 2019, ANRT introduced an opt-out policy for SMS marketing with third-party providers, requiring Maroc Telecom, Orange Morocco, and Inwi to improve customer protection through standardized opt-out mechanisms.
2025 Equipment Regulation Update: On January 20, 2025, ANRT issued Decision ANRT/DG/N°16/24, updating type approval and labeling requirements for telecommunications equipment, effective May 1, 2025.
SMS Marketing Consent Requirements in Morocco (Law 09-08)
Explicit Consent Requirements:
Penalties for Non-Compliance: Under Law No. 09-08, violations are punishable by:
Best Practices for Consent Collection:
Sample Compliant Opt-In Language:
HELP/STOP and Other Commands
Required Features:
Do Not Call / Do Not Disturb Registries
Status: No centralized registry
Morocco does not maintain a centralized Do Not Call registry. You must:
Best Times to Send SMS in Morocco (UTC+1 Timezone & Prayer Times)
Morocco Time Zone: Morocco observes Western European Time (WET/UTC+0) as its base time zone but operates on permanent Daylight Saving Time (UTC+1/WEST) for most of the year. During Ramadan, the country temporarily reverts to UTC+0. Understanding Morocco's timezone is crucial for SMS delivery optimization and compliance with ANRT sending guidelines.
Time Zone Identifier: Africa/Casablanca (IANA)
Recommended SMS Sending Hours:
Prayer Times to Avoid (approximate, vary by city and season):
Consult IslamicFinder Morocco Prayer Times for precise prayer times by city. Complete campaigns before 12:45 PM on Fridays or start after 2:30 PM.
Morocco Sender ID Registration: Alphanumeric IDs, Long Codes & Short Codes
Alphanumeric Sender ID
Operator Network Capability: Fully supported across major networks
Registration Requirements: Pre-registration required
Registration Timeline: Approximately 3 weeks
Step-by-Step Registration Process:
Prepare Required Documentation:
Submit Application:
ANRT Review Process (approximately 3 weeks):
Approval and Activation:
Required Information:
Registration Costs: Fees vary by provider:
Note: Fees are subject to change; confirm current pricing with your SMS provider before registration.
Sender ID Preservation: Yes, preserved across all networks except Inwi
Character Limits: Up to 11 characters (letters and numbers only)
Content Restrictions: No political, religious, unsolicited promotion, or gambling content; P2P traffic prohibited
Long Codes
Support:
Sender ID Preservation: No, international numbers may be overwritten with generic alphanumeric IDs
Use Cases: Not recommended for marketing campaigns; better suited for transactional messages
Short Codes
Status: Not currently supported in Morocco
Alternative: Use pre-registered alphanumeric sender IDs instead
Restricted SMS Content and Carrier Filtering in Morocco
Prohibited Content:
Regulated Industries and Additional Documentation Requirements:
Submit documentation approval requests through your SMS provider with supporting legal documents. Approval typically adds 1–2 weeks to standard registration timelines.
How Do Moroccan Carriers Filter SMS Content?
Known Carrier Filters:
Best Practices to Avoid Filtering:
Real-World Filtering Examples:
Best Practices for Sending SMS in Morocco
Messaging Strategy
Sending Frequency and Timing
Localization
Opt-Out Management
Testing and Monitoring
Key Metrics to Track:
SMS API Integration for Morocco: Twilio, Sinch, MessageBird & Plivo
Twilio
Twilio provides a robust REST API for sending SMS to Morocco. Authentication uses account SID and auth token.
import { Twilio } from 'twilio'; // Initialize Twilio client for Morocco SMS sending const client = new Twilio( process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN ); // Function to send SMS to Morocco async function sendSMSToMorocco( to: string, message: string, senderId: string ): Promise<void> { try { // Ensure proper formatting for Morocco numbers (+212) const formattedNumber = to.startsWith('+212') ? to : `+212${to.slice(-9)}`; const response = await client.messages.create({ body: message, from: senderId, // Pre-registered alphanumeric sender ID to: formattedNumber, // Optional parameters for delivery tracking statusCallback: 'https://your-webhook.com/status' }); console.log(`Message sent successfully! SID: ${response.sid}`); } catch (error) { console.error('Error sending message:', error); throw error; } }Morocco-Specific Error Handling:
async function sendSMSWithMoroccoErrorHandling( to: string, message: string, senderId: string ): Promise<void> { try { const response = await client.messages.create({ body: message, from: senderId, to: to }); console.log(`Message sent: ${response.sid}`); } catch (error: any) { // Handle Morocco-specific errors switch (error.code) { case 21612: console.error('Sender ID not registered for Morocco or invalid combination of To/From'); // Action: Register sender ID through Twilio Console break; case 21614: console.error('Cannot send to landline number in Morocco'); // Action: Remove landline numbers from recipient list break; case 30007: console.error('Message filtered by carrier (content issue)'); // Action: Review message for prohibited content or URL shorteners break; case 30008: console.error('Unknown destination - invalid Morocco number'); // Action: Validate number format (+212XXXXXXXXX) break; default: console.error(`Twilio error ${error.code}: ${error.message}`); } throw error; } }Sinch
Sinch offers a straightforward REST API with JWT authentication for Morocco SMS.
import axios from 'axios'; class SinchSMSClient { private readonly baseUrl: string; private readonly apiToken: string; private readonly servicePlanId: string; constructor(servicePlanId: string, apiToken: string) { this.baseUrl = 'https://sms.api.sinch.com/xms/v1'; this.apiToken = apiToken; this.servicePlanId = servicePlanId; } async sendSMS(to: string, message: string, senderId: string): Promise<void> { try { const response = await axios.post( `${this.baseUrl}/${this.servicePlanId}/batches`, { from: senderId, to: [to], body: message, delivery_report: 'summary' }, { headers: { 'Authorization': `Bearer ${this.apiToken}`, 'Content-Type': 'application/json' } } ); console.log('Message sent:', response.data.id); } catch (error) { console.error('Sinch SMS error:', error); throw error; } } }MessageBird
MessageBird provides a feature-rich API with support for Morocco's specific requirements.
import messagebird from 'messagebird'; class MessageBirdClient { private client: any; constructor(apiKey: string) { this.client = messagebird(apiKey); } sendSMS( to: string, message: string, senderId: string ): Promise<any> { return new Promise((resolve, reject) => { // Configure message parameters const params = { originator: senderId, recipients: [to], body: message, // Morocco-specific parameters datacoding: 'unicode', // For Arabic support type: 'premium' // For business messaging }; this.client.messages.create(params, (err: any, response: any) => { if (err) { reject(err); } else { resolve(response); } }); }); } }Plivo
Plivo offers a reliable API with specific features for Morocco messaging.
import plivo from 'plivo'; class PlivoSMSClient { private client: any; constructor(authId: string, authToken: string) { this.client = new plivo.Client(authId, authToken); } async sendSMS( to: string, message: string, senderId: string ): Promise<void> { try { const response = await this.client.messages.create({ src: senderId, // Your registered sender ID dst: to, // Destination number in E.164 format text: message, // Morocco-specific parameters url_strip_domain: false, // Preserve full URLs powerpack_id: 'your_powerpack_id' // If using Powerpack }); console.log('Message sent:', response.messageUuid); } catch (error) { console.error('Plivo error:', error); throw error; } } }API Rate Limits and Throughput
Default rate limits vary by provider:
Strategies for Large-Scale SMS Sending:
Requesting Rate Limit Increases: Most providers support rate limit increases for verified business accounts. Contact your provider's sales or support team with:
Typical approval time: 3–5 business days. Twilio and Sinch commonly approve increases to 200–500 msg/sec for high-volume senders.
Error Handling and Reporting
Morocco-Specific Error Codes Summary:
Frequently Asked Questions About SMS in Morocco
Do I need to register my sender ID in Morocco?
Yes, Morocco requires pre-registration for alphanumeric sender IDs. The registration process takes approximately 3 weeks and requires you to specify your sender ID (up to 11 alphanumeric characters), SMS type (OTP or Marketing), and SMS content with any URL links. Sender IDs are preserved across all networks except Inwi.
What laws govern SMS marketing in Morocco?
Law No. 09-08 (dated February 18, 2009) governs SMS marketing in Morocco, relating to protection of individuals with regard to personal data processing, and its implementation Decree No. 2-09-165. The CNDP (Commission nationale de contrôle de la protection des données à caractère personnel) oversees enforcement. Obtain explicit opt-in consent before sending marketing SMS and honor opt-out requests within 24 hours per ANRT guidelines.
Do I need consent to send SMS marketing in Morocco?
Yes, obtain clear, documented opt-in consent before sending marketing messages in Morocco. Maintain detailed records of when and how you obtained consent, including consent timestamp, source, and IP address. Store consent records for at least 2 years and obtain prior authorization from CNDP for international data transfers.
Which mobile carriers operate in Morocco?
Morocco has three major mobile carriers: Maroc Telecom (34–38% market share), Orange Morocco (33–34% market share), and Inwi (formerly Wana, 31–32% market share) as of 2024. The market has approximately 49.2 million subscribers with a penetration rate of 137.5%. All three carriers support number portability, allowing users to keep their phone numbers when switching providers.
What time zone does Morocco use for SMS sending?
Morocco observes permanent Daylight Saving Time (UTC+1/WEST) for most of the year. During Ramadan, the country temporarily reverts to UTC+0 (Western European Time). The time zone identifier is Africa/Casablanca (IANA). Send SMS messages between 9:00 AM and 8:00 PM local time, avoiding prayer times (particularly Friday prayers) and religious observances.
What character encoding should I use for Arabic SMS in Morocco?
Use UCS-2 encoding for Arabic text in Morocco, which limits messages to 70 characters per segment. GSM-7 encoding supports 160 characters per segment but only works for standard Latin characters. Messages automatically use the appropriate encoding based on content. Ensure proper right-to-left (RTL) text handling for Arabic content.
How long does it take to start sending SMS in Morocco?
Starting to send SMS in Morocco requires approximately 3 weeks for alphanumeric sender ID registration with ANRT. Provide your sender ID (up to 11 characters), specify SMS type (OTP or Marketing), and submit SMS content with any URL links. International long codes are supported but may be overwritten with generic alphanumeric IDs. Short codes are not currently available in Morocco.
What content is prohibited in SMS messages to Morocco?
Morocco prohibits gambling and betting services, adult content, political messaging without authorization, religious content, illegal substances, and hate speech in SMS messages. Financial services require additional documentation, healthcare messages must comply with Law 09-08 privacy regulations, and debt collection services face strict limitations. Carriers may also block URLs from unknown domains and messages with excessive punctuation or all-caps text.
Summary and Additional Resources
Key Takeaways
Compliance First
Technical Considerations
Best Practices
Next Steps
Estimated Timeline and Effort:
Total estimated time to production: 5–7 weeks from start to first compliant campaign launch.
Additional Resources
Official Regulatory Sources:
Industry Resources:
Technical Documentation: