Spain SMS Messaging Guide: GDPR Compliance, Lista Robinson & Business SMS Regulations
Master SMS marketing in Spain with our comprehensive compliance guide. Learn GDPR requirements, Lista Robinson registration, sender ID setup, and best practices for Spanish mobile networks.
Market Conditions: Spain operates a highly developed mobile market with widespread SMS adoption. The country's major mobile operators – Movistar, Vodafone, and Orange – collectively serve over 55 million mobile subscribers. While OTT messaging apps like WhatsApp dominate personal communications, SMS remains critical for business communications, particularly for authentication, notifications, and marketing. The mobile market divides between Android users (around 80%) and iOS users (around 20%), with smartphone penetration exceeding 80% of the population.
Key SMS Features and Capabilities in Spain
Spain supports comprehensive SMS capabilities that enable effective business communications. These features allow you to reach customers reliably across all major carriers while maintaining message integrity and supporting interactive communications.
Two-way SMS Support in Spain
Spain fully supports two-way SMS communications. Enable conversations by meeting standard compliance requirements: obtain user consent and maintain clear opt-out mechanisms. Use two-way SMS for customer service inquiries, order confirmations with reply options, appointment reminders that accept responses, and feedback collection.
For more information on implementing interactive messaging, see our guide on two-way SMS best practices.
Concatenated Messages (Segmented SMS)
Support: Yes, concatenation is fully supported across Spanish networks.
Message length rules:
GSM-7 encoding: 160 characters for single SMS, 153 characters per segment for concatenated messages
Unicode/UCS-2: 70 characters for single SMS, 67 characters per segment for concatenated messages
Encoding considerations: Use GSM-7 for standard Latin alphabet. Switch to UCS-2 for Spanish-specific characters (ñ, á, é, í, ó, ú).
Character Set
Single Message
Concatenated Segments
Example Use
GSM-7
160 chars
153 chars/segment
Standard English and basic Spanish
UCS-2 (Unicode)
70 chars
67 chars/segment
Text with ñ, á, é, í, ó, ú
Example: "Buenos días" (GSM-7) uses 11 characters. "Buenos días, señor García" requires UCS-2 due to ñ and í, consuming 27 characters from your 70-character limit.
MMS Support
Spanish carriers automatically convert MMS messages to SMS with an embedded URL link to access the multimedia content. This conversion ensures compatibility across all devices while preserving your ability to share rich media. The recipient receives a standard SMS containing your text plus a clickable link to view images, videos, or other multimedia files through their mobile browser.
Recipient Phone Number Compatibility
Number Portability
Spain supports full number portability, allowing users to keep their phone numbers when switching carriers. Spanish telecommunications infrastructure handles all routing automatically – you don't need to adjust your SMS logic or perform special lookups. Send messages to any Spanish mobile number, and the network will deliver them correctly regardless of which operator currently serves that number.
Sending SMS to Landlines
You cannot send SMS to landline numbers in Spain. Attempts fail with a 400 response error (error code 21614). Your account won't be charged for these failed attempts, and failed messages won't appear in logs.
GDPR Compliance and Regulatory Guidelines for SMS Marketing in Spain
Two primary authorities regulate Spain's SMS communications: the Spanish Data Protection Agency (AEPD) enforces GDPR compliance, while the National Commission of Markets and Competition (CNMC) enforces telecommunications regulations. Non-compliance can result in GDPR fines up to €20 million or 4% of annual global turnover (whichever is higher).
Consent and Opt-In Requirements for Spanish SMS
Explicit Consent Requirements:
Obtain written or electronic confirmation from recipients before sending marketing messages. Follow these specific requirements:
Compliant consent collection methods:
Checkbox opt-in on web forms (pre-checked boxes are not compliant)
SMS-based confirmation with double opt-in verification
Signed paper forms with clear disclosure
Email confirmation with explicit acceptance
Non-compliant methods:
Pre-checked boxes or automatic enrollment
Assumed consent from business card collection
Implied consent from website visits
Generic terms and conditions without explicit SMS opt-in
Required disclosure elements:
Clear message purpose (marketing, transactional, or notifications)
Expected frequency (e.g., "up to 4 messages per month")
Company identity and contact information
Data usage and storage practices
Documentation requirements:
Timestamp of when consent was given
Method of consent collection
Exact wording shown to the recipient
IP address or device identifier (for electronic consent)
Proof that consent was freely given and specific
HELP/STOP and Other Commands
Required Keywords:
Support all commands in both Spanish and English. Send response messages in the same language as the received command.
Command
Purpose
Required Response
STOP / ALTO
Opt-out
"You have been unsubscribed. Reply START to opt back in."
BAJA
Unsubscribe
"Su suscripción ha sido cancelada."
AYUDA / HELP
Assistance
"For support, call [number] or visit [URL]. Reply STOP to unsubscribe."
START / INICIO
Opt back in
"Welcome back! You'll now receive our messages."
Do Not Call / Do Not Disturb Registries
Spain maintains the Lista Robinson, a national opt-out registry for marketing communications managed by the Spanish Data Protection Agency (AEPD).
Legal obligations:
Mandatory consultation: Check Lista Robinson before sending marketing messages to contacts who haven't provided explicit consent
Effectiveness window: Inscriptions take up to 2 months to become fully effective, as data may already be in active campaigns
Processing timeframe: Process opt-out requests within 24 hours for internal lists
Spain observes specific time restrictions for commercial SMS:
Permitted Hours: 8:00 AM to 9:00 PM (local time)
Time Zone Considerations:
Mainland Spain: CET (UTC+1) / CEST (UTC+2 during DST)
Canary Islands: WET (UTC+0) / WEST (UTC+1 during DST) – 1 hour behind mainland
DST transitions: Last Sunday in March (forward) and last Sunday in October (back)
Schedule your campaigns accordingly:
Always use Europe/Madrid timezone for mainland Spain
Use Atlantic/Canary timezone for Canary Islands recipients
Account for DST changes when scheduling advance campaigns
Exceptions: Emergency or critical service messages (account security alerts, fraud warnings, service outages)
Holiday Considerations: Avoid sending during national and regional holidays. Major dates include January 1, January 6 (Epiphany), Easter Thursday–Monday, May 1, August 15, October 12, November 1, December 6, December 8, and December 25.
Phone Numbers Options and SMS Sender Types for Spain
Alphanumeric Sender ID
Operator network capability: Fully supported across all major networks
Registration requirements: No pre-registration required for standard usage. Dynamic sender IDs work immediately.
Special considerations: MEF-Protected Sender IDs (brand names registered with MEF) require a Letter of Authorization (LOA) from June 6, 2024. Apply for LOA through your SMS provider by submitting proof of brand ownership (trademark registration, company registration documents).
Sender ID preservation: Yes, sender IDs display exactly as specified
Character limits: Up to 11 alphanumeric characters (A-Z, a-z, 0-9, spaces)
Global communications, roaming support, cross-border campaigns
Sender ID preservation: Yes, maintained across all major carriers
Capabilities:
Support inbound messages for two-way conversations
Enable reply-based interactions
Maintain consistent customer touchpoint
Lower throughput than short codes (typically 1–10 messages/second)
Short Codes
Support: Fully available in Spain
Provisioning time: 12–14 weeks (includes carrier review and approval)
Application process:
Select 4-digit or 5-digit short code
Submit use case description to carriers
Provide sample message templates
Complete carrier compliance review
Pay setup fees (€5,000–€15,000) and monthly fees (€500–€2,000)
Wait for multi-carrier approval
Complete technical integration testing
Use cases:
High-volume marketing campaigns (up to 100 messages/second)
Two-factor authentication at scale
Customer engagement programs (voting, contests)
Premium rate services with carrier billing
Restricted SMS Content, Industries, and Use Cases
Prohibited Content:
Spain enforces strict content restrictions under the Spanish Penal Code (Articles 197–204 for privacy violations) and Law 34/1988 on advertising regulations:
Cannabis-related content (strictly forbidden under all circumstances)
Gambling without proper licensing (requires Spanish Directorate General for Gaming Regulation approval)
Adult content (pornography, explicit sexual services)
Unauthorized financial services (requires Bank of Spain or CNMV licensing)
Political messaging without proper disclosure (must comply with Electoral Law requirements)
Content Filtering
Carrier Filtering Rules:
Spanish carriers employ multi-layer spam detection systems that analyze:
Keyword patterns: Known spam phrases, restricted industry terms
Include opt-out instructions in every marketing message
Warm up new sender IDs gradually (start with low volume, increase over 2–4 weeks)
Register sender IDs with carriers when possible
Best Practices for Sending SMS in Spain
Messaging Strategy
Craft effective messages with these proven techniques:
Keep messages under 160 characters – Single-segment messages have higher deliverability and lower costs
Lead with value – State the benefit or action in the first 20 characters
Include clear call-to-action – Use specific verbs like "Reply YES," "Visit [URL]," or "Call now"
Personalize using data – Insert recipient's name, order number, or relevant details
Maintain consistent brand voice – Use the same tone, terminology, and style across campaigns
Sending Frequency and Timing
Recommended frequency: Limit to 2–4 messages per month per recipient. Spanish consumers report optimal engagement at this frequency, with higher volumes triggering opt-outs.
Optimal sending times:
Peak engagement: 10:00–13:00 and 17:00–20:00 on weekdays
Avoid: 14:00–16:00 (siesta time), Sundays, national holidays
Business hours: 9:00–14:00, 16:00–19:00 for professional communications
Scheduling strategy:
Schedule promotional messages for Tuesday–Thursday (highest engagement)
What are the SMS compliance requirements for Spain?
Follow this compliance checklist:
Required actions:
Obtain explicit written or electronic consent before sending marketing SMS
Check the Lista Robinson opt-out registry monthly
Provide clear opt-out mechanisms (STOP/ALTO commands)
Send only during permitted hours (8:00 AM to 9:00 PM)
Document all consent with timestamp and method
Process opt-out requests within 24 hours
Include company identification in every message
Regulatory authorities: Spain enforces GDPR through the AEPD (Spanish Data Protection Agency). Non-compliance can result in fines up to €20 million or 4% of annual global turnover.
How long does Lista Robinson registration take to become effective?
Lista Robinson inscriptions take up to 2 months to become fully effective, as recipient data may already be in active campaigns. However, process opt-out requests to your internal suppression lists within 24 hours. Check the Lista Robinson database monthly before launching campaigns.
What sender ID types are supported in Spain?
Spain supports three sender ID types:
Alphanumeric sender IDs: No pre-registration required, but MEF-Protected IDs need LOA from June 6, 2024
Long codes: Immediate to 24-hour provisioning for domestic and international messaging
Short codes: 12–14 weeks provisioning for high-volume campaigns (€5,000–€15,000 setup fee)
Can I send SMS to Spanish landline numbers?
No, you cannot send SMS to landline numbers in Spain. Attempts fail with a 400 response error (error code 21614). Your account won't be charged, and failed messages won't appear in logs.
What are the permitted hours for commercial SMS in Spain?
Send commercial SMS only between 8:00 AM and 9:00 PM local time. Remember that the Canary Islands (Atlantic/Canary timezone) are 1 hour behind mainland Spain (Europe/Madrid timezone). Emergency or critical service messages are exempt from these restrictions. Avoid sending during Sundays, national holidays, and regional holidays.
What character encoding should I use for Spanish SMS?
Encoding
Characters
Single SMS
Concatenated Segments
When to Use
GSM-7
A-Z, a-z, 0-9, basic punctuation
160 chars
153 chars/segment
Standard Latin alphabet
UCS-2 (Unicode)
ñ, á, é, í, ó, ú, special symbols
70 chars
67 chars/segment
Spanish-specific characters
Example: "Hola, su pedido está listo" requires UCS-2 due to á, consuming 28 of your 70 characters.
Which keywords must I support for opt-out in Spain?
Support both Spanish and English opt-out keywords:
STOP/ALTO: Opt-out
BAJA: Unsubscribe
AYUDA/HELP: Assistance
START/INICIO: Opt back in (optional but recommended)
Send response messages in the same language as the received command. Process opt-outs within 24 hours.
What content is prohibited in Spain SMS marketing?
Spain prohibits:
Cannabis-related content (strictly forbidden under all circumstances)
Gambling without Spanish Directorate General for Gaming Regulation approval
Adult content (pornography, explicit sexual services)
Unauthorized financial services (requires Bank of Spain or CNMV licensing)
Political messaging without Electoral Law disclosure
Carriers filter keywords related to restricted industries, suspicious URLs, high-frequency identical messages, and messages without opt-out information.
How do Spanish mobile operators handle number portability?
Spanish mobile operators handle number portability efficiently without impacting SMS delivery or routing. Users can keep their phone numbers when switching between Movistar, Vodafone, Orange, and other carriers. You don't need to adjust your SMS sending logic for ported numbers – the network automatically routes messages to the correct current carrier.
What are the main differences between Spanish regional SMS requirements?
While GDPR and Lista Robinson apply nationwide, consider these regional factors:
Language preferences by region:
Catalonia: Offer Catalan option (7.7 million speakers)
Basque Country: Provide Basque for regional campaigns (2.2 million speakers)
Galicia: Use Galician for strong regional resonance (2.7 million speakers)
Valencia: Offer Valencian variant (5 million speakers)
Regional holidays: Respect regional holidays in addition to national ones. Each autonomous community has 2–4 additional holidays per year.
Time zone: The Canary Islands operate in Atlantic/Canary timezone (1 hour behind mainland Spain's Europe/Madrid timezone).
Frequently asked questions
Spain's mobile market is highly developed, with over 55 million subscribers across major operators like Movistar, Vodafone, and Orange. While WhatsApp is popular, SMS remains essential for business uses like authentication and marketing, with high smartphone and SMS usage rates.
Several SMS APIs like Twilio, Sinch, MessageBird, and Plivo offer robust solutions for sending SMS to Spain. Ensure compliance with Spanish regulations and best practices for optimal delivery and engagement.
MMS messages are automatically converted to SMS with a URL link to the media content. This ensures broad compatibility across all devices in Spain, while still allowing for rich media sharing.
Adhere to permitted hours (8:00 AM to 9:00 PM local time), considering the time difference for the Canary Islands. Avoid sending during national and regional holidays, Sundays, and siesta time (2 PM - 4PM).
No, sending SMS to landlines in Spain isn't supported and will result in failed delivery with a 400 response error (code 21614) via SMS APIs. You won't be charged for these attempts.
Comply with GDPR, obtain explicit consent, and honor opt-outs. Respect the Lista Robinson (national opt-out registry), permitted sending hours (8 am-9 pm), and required keywords like STOP/ALTO/BAJA/AYUDA/HELP.
GSM-7 encoding allows 160 characters for single SMS and 153 per concatenated segment. Unicode/UCS-2 allows 70 characters for single SMS and 67 per segment. Choose the encoding based on character types.
Process opt-out requests (STOP/ALTO/BAJA) within 24 hours, maintain a centralized opt-out database, confirm the opt-out, and regularly audit your lists for accuracy.
Spain supports alphanumeric sender IDs, long codes (domestic and international), and short codes. Alphanumeric Sender IDs do not require pre-registration. Short codes take 12-14 weeks to provision.
Cannabis-related content is strictly forbidden. Gambling, adult content, unauthorized financial services, and political messaging without proper disclosures are also prohibited.
Keep messages concise, include clear calls-to-action, personalize when possible, use appropriate language and formatting, respect sending hours, and ensure easy opt-out methods.
Use Twilio's REST API with your account SID and auth token. Specify the recipient's Spanish number with the +34 country code, and include a status callback URL for delivery tracking.
Standard rate limits vary by provider, with Twilio around 100/second, Sinch at 50/second, MessageBird at 60/second, and Plivo at 80/second. Implement queueing and backoff strategies.
Employ queue systems (Redis/RabbitMQ), utilize batch APIs, implement exponential backoff for retries, and monitor rate limit headers to optimize SMS throughput and avoid exceeding limits.
Spain SMS Market Overview
Market Conditions: Spain operates a highly developed mobile market with widespread SMS adoption. The country's major mobile operators – Movistar, Vodafone, and Orange – collectively serve over 55 million mobile subscribers. While OTT messaging apps like WhatsApp dominate personal communications, SMS remains critical for business communications, particularly for authentication, notifications, and marketing. The mobile market divides between Android users (around 80%) and iOS users (around 20%), with smartphone penetration exceeding 80% of the population.
Key SMS Features and Capabilities in Spain
Spain supports comprehensive SMS capabilities that enable effective business communications. These features allow you to reach customers reliably across all major carriers while maintaining message integrity and supporting interactive communications.
Two-way SMS Support in Spain
Spain fully supports two-way SMS communications. Enable conversations by meeting standard compliance requirements: obtain user consent and maintain clear opt-out mechanisms. Use two-way SMS for customer service inquiries, order confirmations with reply options, appointment reminders that accept responses, and feedback collection.
For more information on implementing interactive messaging, see our guide on two-way SMS best practices.
Concatenated Messages (Segmented SMS)
Support: Yes, concatenation is fully supported across Spanish networks.
Message length rules:
Encoding considerations: Use GSM-7 for standard Latin alphabet. Switch to UCS-2 for Spanish-specific characters (ñ, á, é, í, ó, ú).
Example: "Buenos días" (GSM-7) uses 11 characters. "Buenos días, señor García" requires UCS-2 due to ñ and í, consuming 27 characters from your 70-character limit.
MMS Support
Spanish carriers automatically convert MMS messages to SMS with an embedded URL link to access the multimedia content. This conversion ensures compatibility across all devices while preserving your ability to share rich media. The recipient receives a standard SMS containing your text plus a clickable link to view images, videos, or other multimedia files through their mobile browser.
Recipient Phone Number Compatibility
Number Portability
Spain supports full number portability, allowing users to keep their phone numbers when switching carriers. Spanish telecommunications infrastructure handles all routing automatically – you don't need to adjust your SMS logic or perform special lookups. Send messages to any Spanish mobile number, and the network will deliver them correctly regardless of which operator currently serves that number.
Sending SMS to Landlines
You cannot send SMS to landline numbers in Spain. Attempts fail with a 400 response error (error code 21614). Your account won't be charged for these failed attempts, and failed messages won't appear in logs.
GDPR Compliance and Regulatory Guidelines for SMS Marketing in Spain
Two primary authorities regulate Spain's SMS communications: the Spanish Data Protection Agency (AEPD) enforces GDPR compliance, while the National Commission of Markets and Competition (CNMC) enforces telecommunications regulations. Non-compliance can result in GDPR fines up to €20 million or 4% of annual global turnover (whichever is higher).
Consent and Opt-In Requirements for Spanish SMS
Explicit Consent Requirements:
Obtain written or electronic confirmation from recipients before sending marketing messages. Follow these specific requirements:
Compliant consent collection methods:
Non-compliant methods:
Required disclosure elements:
Documentation requirements:
HELP/STOP and Other Commands
Required Keywords:
Support all commands in both Spanish and English. Send response messages in the same language as the received command.
Do Not Call / Do Not Disturb Registries
Spain maintains the Lista Robinson, a national opt-out registry for marketing communications managed by the Spanish Data Protection Agency (AEPD).
Legal obligations:
Access and integration process:
Best practices:
Source: Lista Robinson Official Registry, AEPD Guidelines
Time Zone Sensitivity
Spain observes specific time restrictions for commercial SMS:
Permitted Hours: 8:00 AM to 9:00 PM (local time)
Time Zone Considerations:
Schedule your campaigns accordingly:
Exceptions: Emergency or critical service messages (account security alerts, fraud warnings, service outages)
Holiday Considerations: Avoid sending during national and regional holidays. Major dates include January 1, January 6 (Epiphany), Easter Thursday–Monday, May 1, August 15, October 12, November 1, December 6, December 8, and December 25.
Phone Numbers Options and SMS Sender Types for Spain
Alphanumeric Sender ID
Operator network capability: Fully supported across all major networks
Registration requirements: No pre-registration required for standard usage. Dynamic sender IDs work immediately.
Special considerations: MEF-Protected Sender IDs (brand names registered with MEF) require a Letter of Authorization (LOA) from June 6, 2024. Apply for LOA through your SMS provider by submitting proof of brand ownership (trademark registration, company registration documents).
Sender ID preservation: Yes, sender IDs display exactly as specified
Character limits: Up to 11 alphanumeric characters (A-Z, a-z, 0-9, spaces)
Best practices:
Long Codes
Domestic vs. International: Both supported
Sender ID preservation: Yes, maintained across all major carriers
Capabilities:
Short Codes
Support: Fully available in Spain
Provisioning time: 12–14 weeks (includes carrier review and approval)
Application process:
Use cases:
Restricted SMS Content, Industries, and Use Cases
Prohibited Content:
Spain enforces strict content restrictions under the Spanish Penal Code (Articles 197–204 for privacy violations) and Law 34/1988 on advertising regulations:
Content Filtering
Carrier Filtering Rules:
Spanish carriers employ multi-layer spam detection systems that analyze:
Best Practices to Avoid Filtering:
Best Practices for Sending SMS in Spain
Messaging Strategy
Craft effective messages with these proven techniques:
Sending Frequency and Timing
Recommended frequency: Limit to 2–4 messages per month per recipient. Spanish consumers report optimal engagement at this frequency, with higher volumes triggering opt-outs.
Optimal sending times:
Scheduling strategy:
Localization
Formatting standards:
Cultural considerations:
Opt-Out Management
Process opt-outs efficiently to maintain compliance:
Testing and Monitoring
Pre-launch testing checklist:
Ongoing monitoring metrics:
A/B testing priorities:
SMS API integrations for Spain
Twilio
Twilio provides a robust REST API for sending SMS to Spain. Authentication uses account SID and auth token.
import { Twilio } from 'twilio'; // Initialize client with environment variables const client = new Twilio( process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN ); async function sendSMSToSpain() { try { // Send message with Spanish number formatting const message = await client.messages.create({ body: 'Hola! Este es un mensaje de prueba.', from: '+34XXXXXXXXX', // Spanish sender number to: '+34XXXXXXXXX', // Spanish recipient number statusCallback: 'https://your-callback-url.com/status' }); console.log(`Message sent successfully! SID: ${message.sid}`); return message.sid; } catch (error) { // Handle specific Twilio errors if (error.code === 21614) { console.error('Invalid Spanish number format'); } else if (error.code === 21408) { console.error('Permission denied for Spain messaging'); } else { console.error('Error sending message:', error); } throw error; } }Sinch
Sinch offers a straightforward REST API with bearer token authentication.
import axios from 'axios'; const SINCH_API_TOKEN = process.env.SINCH_API_TOKEN; const SINCH_SERVICE_PLAN_ID = process.env.SINCH_SERVICE_PLAN_ID; async function sendSinchSMS() { try { const response = await axios.post( `https://sms.api.sinch.com/xms/v1/${SINCH_SERVICE_PLAN_ID}/batches`, { from: 'YourBrand', // Alphanumeric sender ID to: ['+34XXXXXXXXX'], body: 'Su mensaje de confirmación', delivery_report: 'summary' }, { headers: { 'Authorization': `Bearer ${SINCH_API_TOKEN}`, 'Content-Type': 'application/json' } } ); console.log('Batch ID:', response.data.id); return response.data.id; } catch (error) { console.error('Sinch API error:', error.response?.data); throw error; } }MessageBird
MessageBird provides a feature-rich API with support for various message types.
import messagebird from 'messagebird'; const client = messagebird(process.env.MESSAGEBIRD_API_KEY); function sendMessageBirdSMS() { const params = { originator: 'CompanyName', recipients: ['+34XXXXXXXXX'], body: 'Mensaje importante de su empresa', language: 'es', reportUrl: 'https://your-webhook.com/delivery-status' }; client.messages.create(params, (err, response) => { if (err) { console.error('MessageBird error:', err); return; } console.log('Message sent successfully:', response.id); }); }Plivo
Plivo offers a powerful API with support for high-volume messaging.
import plivo from 'plivo'; const client = new plivo.Client( process.env.PLIVO_AUTH_ID, process.env.PLIVO_AUTH_TOKEN ); async function sendPlivoSMS() { try { const response = await client.messages.create({ src: '+34XXXXXXXXX', // Your Plivo Spanish number dst: '+34XXXXXXXXX', // Destination Spanish number text: 'Su mensaje de texto', url: 'https://your-callback-url.com/status', type: 'sms' }); console.log('Message UUID:', response.messageUuid); return response.messageUuid; } catch (error) { console.error('Plivo error:', error); throw error; } }API Rate Limits and Throughput
Note: Actual throughput depends on account tier, payment history, and destination country. Contact providers to request rate limit increases.
Throughput Management Strategies:
Queue-based systems (recommended for >1,000 messages/hour):
import Bull from 'bull'; const smsQueue = new Bull('sms-queue', { redis: { host: 'localhost', port: 6379 } }); // Producer: Add messages to queue async function queueSMS(to: string, body: string) { await smsQueue.add({ to, body, timestamp: Date.now() }, { attempts: 3, backoff: { type: 'exponential', delay: 2000 } }); } // Consumer: Process messages with rate limiting smsQueue.process(10, async (job) => { // Process 10 concurrent jobs await sendSMSToSpain(job.data.to, job.data.body); });Batch API usage (for bulk sends):
Exponential backoff (for retry logic):
async function sendWithRetry(messageData: any, maxRetries = 3) { for (let attempt = 0; attempt < maxRetries; attempt++) { try { return await sendSMS(messageData); } catch (error) { if (attempt === maxRetries - 1) throw error; const delay = Math.pow(2, attempt) * 1000; // 1s, 2s, 4s await new Promise(resolve => setTimeout(resolve, delay)); } } }Monitor rate limit headers:
X-RateLimit-Limit: Total requests allowed per windowX-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Timestamp when limit resetsError Handling and Reporting
Spain-specific error codes:
Comprehensive error handling implementation:
async function sendWithErrorHandling(to: string, body: string) { try { const message = await client.messages.create({ to, body, from: '+34XXX' }); // Log successful send await logMessageStatus({ messageId: message.sid, to, status: 'sent', timestamp: new Date() }); return message; } catch (error) { // Parse error details const errorCode = error.code; const errorMessage = error.message; // Log failure with details await logMessageStatus({ to, status: 'failed', errorCode, errorMessage, timestamp: new Date() }); // Alert on critical errors if (['30007', '30010'].includes(errorCode)) { await alertContentFiltering(to, body, errorCode); } throw error; } }Monitoring and alerting setup:
Recap and Additional Resources
Key Takeaways:
Next Steps:
Additional Resources:
Learn more about E.164 phone number formatting for international SMS delivery, or explore our guide on OTP and 2FA implementation for authentication use cases.
Frequently Asked Questions
What are the SMS compliance requirements for Spain?
Follow this compliance checklist:
Required actions:
Regulatory authorities: Spain enforces GDPR through the AEPD (Spanish Data Protection Agency). Non-compliance can result in fines up to €20 million or 4% of annual global turnover.
How long does Lista Robinson registration take to become effective?
Lista Robinson inscriptions take up to 2 months to become fully effective, as recipient data may already be in active campaigns. However, process opt-out requests to your internal suppression lists within 24 hours. Check the Lista Robinson database monthly before launching campaigns.
What sender ID types are supported in Spain?
Spain supports three sender ID types:
Can I send SMS to Spanish landline numbers?
No, you cannot send SMS to landline numbers in Spain. Attempts fail with a 400 response error (error code 21614). Your account won't be charged, and failed messages won't appear in logs.
What are the permitted hours for commercial SMS in Spain?
Send commercial SMS only between 8:00 AM and 9:00 PM local time. Remember that the Canary Islands (Atlantic/Canary timezone) are 1 hour behind mainland Spain (Europe/Madrid timezone). Emergency or critical service messages are exempt from these restrictions. Avoid sending during Sundays, national holidays, and regional holidays.
What character encoding should I use for Spanish SMS?
Example: "Hola, su pedido está listo" requires UCS-2 due to á, consuming 28 of your 70 characters.
Which keywords must I support for opt-out in Spain?
Support both Spanish and English opt-out keywords:
Send response messages in the same language as the received command. Process opt-outs within 24 hours.
What content is prohibited in Spain SMS marketing?
Spain prohibits:
Carriers filter keywords related to restricted industries, suspicious URLs, high-frequency identical messages, and messages without opt-out information.
How do Spanish mobile operators handle number portability?
Spanish mobile operators handle number portability efficiently without impacting SMS delivery or routing. Users can keep their phone numbers when switching between Movistar, Vodafone, Orange, and other carriers. You don't need to adjust your SMS sending logic for ported numbers – the network automatically routes messages to the correct current carrier.
What are the main differences between Spanish regional SMS requirements?
While GDPR and Lista Robinson apply nationwide, consider these regional factors:
Language preferences by region:
Regional holidays: Respect regional holidays in addition to national ones. Each autonomous community has 2–4 additional holidays per year.
Time zone: The Canary Islands operate in Atlantic/Canary timezone (1 hour behind mainland Spain's Europe/Madrid timezone).