Thailand SMS Guide: NBTC & PDPA Compliance, Sender ID Registration & API Setup
Complete Thailand SMS messaging guide: NBTC regulations, PDPA compliance requirements, alphanumeric sender ID registration (2-week process), Thai language encoding (UCS-2), and API integration for Twilio, Sinch, MessageBird, and Plivo.
Send SMS messages to Thailand mobile numbers with full regulatory compliance. This guide covers NBTC (National Broadcasting and Telecommunications Commission) regulations, PDPA (Personal Data Protection Act) requirements, and technical implementation for Thai SMS messaging. Learn how to register alphanumeric sender IDs, implement proper Thai language encoding (UCS-2), and integrate SMS APIs for Thailand's three major mobile carriers: AIS, DTAC, and True Move.
This guide covers compliance requirements, technical specifications, and production-ready code examples for Twilio, Sinch, MessageBird, and Plivo SDKs. Whether you're implementing authentication messages, marketing campaigns, or transactional notifications, you'll find essential information about time restrictions, opt-out management, and content filtering rules specific to Thailand's telecommunications ecosystem.
Thailand SMS Market Overview & Mobile Network Information
Locale name:
Thailand
ISO code:
TH
Region
Asia
Mobile country code (MCC)
520
Dialing Code
+66
Market Conditions: Thailand operates a vibrant mobile market with high SMS adoption rates alongside popular OTT messaging apps like LINE and WhatsApp. Three major mobile operators – AIS, DTAC, and True Move – serve a predominantly Android user base (approximately 75% market share as of 2024). While OTT messaging apps dominate personal communications, SMS remains crucial for business communications, particularly authentication, notifications, and marketing due to its reliability and universal reach.
Note: Verify market share statistics with recent industry reports, as mobile market dynamics change frequently.
SMS Features and Technical Capabilities for Thailand
Thailand offers robust SMS capabilities with support for concatenated messages and alphanumeric sender IDs. Two-way messaging is not supported, and MMS requires URL conversion.
Two-Way SMS Support in Thailand (A2P Messaging)
Two-way SMS is not supported in Thailand for A2P (Application-to-Person) messaging. Use one-way messaging for your communications – you cannot receive replies from recipients.
Alternative approaches for customer responses:
Direct customers to a web form or support portal
Use a dedicated support phone line for inquiries
Integrate with WhatsApp or LINE for two-way conversations
Include a customer service email address in your messages
Concatenated Messages (Segmented SMS)
Support: Yes, concatenation works for most sender ID types, though support may vary based on your specific sender ID.
Message length rules: Standard 160 characters per message segment using GSM-7 encoding.
Encoding considerations: Messages use GSM-7 encoding for Latin characters (160 characters) or UCS-2 for Thai language and special characters (70 characters per segment).
MMS Support
MMS messages automatically convert to SMS with an embedded URL link. When you send rich media content, the system generates a URL where recipients can access the media and includes this URL in the SMS message body. Use full-length URLs rather than shortened ones – URL shorteners are considered prohibited content in Thailand.
Recipient Phone Number Compatibility
Number Portability
Number portability is available in Thailand, allowing users to keep their phone numbers when switching between mobile operators. This feature does not significantly impact SMS delivery or routing, as messages route properly to the current carrier.
Sending SMS to Landlines
You cannot send SMS to landline numbers in Thailand. Attempts to send messages to landline numbers result in a 400 response with error code 21614. The message will not appear in logs, and your account will not be charged.
Validate mobile numbers before sending:
TypeScript
functionisValidThaiMobile(phoneNumber: string): boolean {
// Thai mobile numbers start with 6, 8, or 9 after country codeconst mobilePattern = /^\+66[689]\d{8}$/;
return mobilePattern.test(phoneNumber);
}
Thailand's SMS communications are regulated by the National Broadcasting and Telecommunications Commission (NBTC), which enforces guidelines for commercial messaging. The Personal Data Protection Act (PDPA), effective May 2022, governs how businesses handle customer data and consent management. (NBTC Official Website | Thailand PDPA, accessed January 2025)
Important: The PDPA B.E. 2562 (2019) came into full enforcement on June 1, 2022. Maintain compliance with both NBTC telecommunications regulations and PDPA data protection requirements.
PDPA Consent Requirements for Thailand SMS Marketing
Explicit Consent Requirements:
Obtain written or electronic consent before sending any marketing messages
Maintain consent records for at least 3 months (recommended: retain for audit purposes)
Clearly state the purpose of messaging during opt-in
Specify the types of messages customers will receive
Best Practices for Documentation:
Store timestamp and source of consent
Maintain audit trails of consent changes
Use double opt-in for marketing lists
Provide clear terms and conditions during signup
HELP/STOP and Other Commands
Support both English and Thai opt-out keywords:
English keywords:
STOP (unsubscribe)
CANCEL (unsubscribe)
HELP (information)
Thai keywords:
หยุด (stop)
ยกเลิก (cancel)
ช่วยเหลือ (help)
Implementation requirements:
Send opt-out confirmation messages in the same language as the opt-out request
Process commands within 24 hours of receipt
Include your company name and contact information in HELP responses
Provide clear instructions on how to opt back in
Example HELP response structure:
Code
[Company Name] SMS Service. Reply STOP to unsubscribe. Support: [email/phone]. Msg&data rates may apply.
Note: While there is no centralized opt-out standard in Thailand, implementing bilingual opt-out support is considered best practice for compliance and user experience.
Do Not Call / Do Not Disturb Registries
Thailand does not maintain a centralized Do Not Call registry. Maintain your own suppression lists:
Honor opt-out requests immediately
Remove numbers within 24 hours of receiving an opt-out request
Regularly clean contact lists to remove inactive numbers
Time Zone Sensitivity
Prohibited hours for marketing messages: 9 PM – 9 AM (ICT – UTC+7)
Exempt message types: Emergency and transactional messages are exempt from time restrictions.
Holiday considerations: Avoid sending marketing messages during major Buddhist holidays and weekends.
Validate sending time before dispatching:
TypeScript
functionisValidSendingTime(): boolean {
const now = newDate();
const bangkokTime = newDate(now.toLocaleString('en-US', { timeZone: 'Asia/Bangkok' }));
const hour = bangkokTime.getHours();
// Marketing messages allowed between 9 AM and 9 PMreturn hour >= 9 && hour < 21;
}
Thailand SMS Sender ID Options: Alphanumeric, Long Codes & Short Codes
Alphanumeric Sender ID Registration for Thailand
Operator network capability: Fully supported
Registration requirements: Pre-registration required; 2-week approval process typically required
Sender ID preservation: Yes, displayed as registered
Additional requirements:
Must be 11 characters or less
Cannot contain special characters
Must match registered business name
Important: Allow adequate lead time for sender ID registration before campaign launches. Registration timelines may vary by operator and may be longer during high-volume periods.
Long Codes
Domestic vs. International:
Domestic long codes supported but not available to international businesses
International long codes not supported
Sender ID preservation: No, international numbers are typically overwritten
Provisioning time: N/A for international businesses
Use cases: Not recommended for international businesses
Short Codes
Support: Not available for international businesses
Provisioning time: N/A
Use cases: Reserved for domestic entities only
Prohibited Content & Industry Restrictions for Thailand SMS
Prohibited Content and Industries:
Gambling and betting services
Adult content or explicit material
Political messaging
Religious content
Financial loan solicitations
Controlled substances
Cannabis products
Alcohol-related content
Firearms and weapons
Financial Services Restrictions:
Obtain Bank of Thailand license for loan-related content
Prohibit URLs in banking/financial messages
Content Filtering
Carrier Filtering Rules:
URL shorteners automatically blocked
Keywords related to restricted industries filtered
Messages containing spam indicators blocked
Best Practices to Avoid Filtering:
Use full-length, registered URLs only
Avoid excessive punctuation
Don't use all caps
Maintain consistent sender IDs
Register URLs with carriers before use
Best Practices for Thailand SMS Campaigns & Delivery Optimization
Messaging Strategy
Structure your messages for clarity:
Keep messages under 160 characters when possible
Include clear call-to-action
Use registered sender IDs consistently
Avoid promotional language in transactional messages
Message template examples:
Authentication/OTP:
Code
Your [Company] verification code is 123456. Valid for 5 minutes. Do not share this code.
Transactional notification:
Code
[Company]: Your order #12345 has shipped. Track at [URL]. Questions? Contact [support].
Marketing message:
Code
[Company]: 20% off all items this weekend. Shop now at [URL]. Reply STOP to unsubscribe.
Bilingual message formatting:
English first, Thai second (or vice versa based on audience preference)
Separate languages with a clear delimiter (e.g., " | ")
Keep total character count under encoding limits
Sending Frequency and Timing
Limit to one promotional message per day per recipient
Respect quiet hours (9 PM – 9 AM)
Avoid sending during major holidays
Space out bulk campaigns to prevent network congestion
Localization
Support both Thai and English content
Use proper Thai character encoding (UCS-2)
Consider cultural sensitivities in message content
Provide customer support in both languages
Opt-Out Management
Process opt-outs within 24 hours
Send confirmation of opt-out
Maintain unified suppression lists across campaigns
Audit opt-out compliance regularly
Testing and Monitoring
Test across all major carriers: AIS, DTAC, True Move
Monitor key metrics:
Delivery rates by carrier
Opt-out rates and patterns
URL click-through rates for compliance
Regular testing:
Test opt-out functionality regularly
Verify proper encoding for Thai characters
Check sender ID display across carriers
Set up monitoring with recommended tools:
Use Datadog, New Relic, or similar for real-time alerting
Implement Prometheus and Grafana for metrics visualization
Configure Sentry for error tracking and reporting
Set up custom dashboards for delivery rate monitoring
Thailand SMS FAQ: Common Questions & Answers
How long does it take to register an alphanumeric sender ID in Thailand?
Sender ID registration in Thailand typically requires a 2-week approval process. Allow adequate lead time before campaign launches, as timelines may vary by operator and extend during high-volume periods.
What character encoding should I use for Thai language SMS?
Use UCS-2 encoding for Thai language messages. UCS-2 provides 70 characters per SMS segment, compared to GSM-7 encoding which provides 160 characters for Latin characters only.
Can I send marketing SMS in Thailand at any time?
No. Prohibit marketing messages between 9 PM and 9 AM (ICT – UTC+7). Emergency and transactional messages are exempt from these time restrictions. Consider Buddhist holidays and weekends when planning campaigns.
Do I need PDPA compliance for SMS marketing in Thailand?
Yes. The Personal Data Protection Act (PDPA) came into full enforcement on June 1, 2022. Obtain written or electronic consent before sending marketing messages and maintain consent records for at least 3 months (recommended: retain for audit purposes).
Are URL shorteners allowed in Thailand SMS messages?
No. URL shorteners are automatically blocked by carriers in Thailand. Use full-length, registered URLs only. Register URLs with carriers before use to avoid filtering.
Which SMS providers support Thailand messaging?
Major SMS providers supporting Thailand include Twilio (Node.js 14-22 LTS), Sinch (@sinch/sdk-core with OAuth2/API Token), MessageBird (Node.js >= 0.10), and Plivo. All support Thai language encoding and pre-registered sender IDs.
Can I receive SMS replies in Thailand?
No. Two-way SMS is not supported for A2P (Application-to-Person) messaging in Thailand. Use one-way messaging only – you cannot receive replies from recipients.
What happens if I send SMS to a landline in Thailand?
Attempts to send SMS to landline numbers result in a 400 response with error code 21614. The message will not appear in logs, and your account will not be charged.
How do I implement opt-out functionality for Thailand SMS?
Support both English and Thai keywords: STOP/หยุด (stop), CANCEL/ยกเลิก (cancel), HELP/ช่วยเหลือ (help). Send confirmation messages in the same language as the opt-out request. Process commands within 24 hours and maintain your own suppression lists.
What content is prohibited in Thailand SMS messages?
Prohibited content includes gambling, adult content, political messaging, religious content, financial loan solicitations (without Bank of Thailand license), controlled substances, cannabis products, alcohol, and firearms. URLs are prohibited in banking/financial messages.
Thailand SMS API Integration: Twilio, Sinch, MessageBird & Plivo
Twilio SMS API for Thailand
Twilio provides robust SMS capabilities for Thailand through their REST API. Authentication uses your Account SID and Auth Token, with support for pre-registered sender IDs. Twilio Node.js SDK supports Node.js 14, 16, 18, 20, and 22 LTS as of January 2025. (npm: twilio, accessed January 2025)
TypeScript
import twilio from'twilio';
// Initialize client with your credentialsconst client = twilio(
process.env.TWILIO_ACCOUNT_SID,
process.env.TWILIO_AUTH_TOKEN
);
// Function to send SMS to ThailandasyncfunctionsendThaiSMS(to: string,
message: string,
senderId: string) {
try {
// Validate sending time for marketing messagesif (!isValidSendingTime()) {
thrownewError('Cannot send marketing messages between 9 PM and 9 AM ICT');
}
// Ensure proper formatting for Thailand numbersconst formattedNumber = to.startsWith('+66') ? to : `+66${to.substring(1)}`;
const response = await client.messages.create({
body: message,
from: senderId, // Must be pre-registeredto: formattedNumber,
// Optional parameters for delivery trackingstatusCallback: 'https://your-webhook.com/status'
});
console.log(`Message sent successfully: ${response.sid}`);
return response;
} catch (error) {
console.error('Error sending message:', error);
throw error;
}
}
functionisValidSendingTime(): boolean {
const now = newDate();
const bangkokTime = newDate(now.toLocaleString('en-US', { timeZone: 'Asia/Bangkok' }));
const hour = bangkokTime.getHours();
// Marketing messages allowed between 9 AM and 9 PMreturn hour >= 9 && hour < 21;
}
Sinch offers SMS services with support for Thai language and pre-registered sender IDs. Use @sinch/sdk-core for OAuth2 or API Token authentication. The SDK supports all current Sinch APIs, including SMS API with region-specific configurations. (npm: @sinch/sdk-core | Sinch SMS API Docs, accessed January 2025)
MessageBird provides SMS API access with specific support for Thailand's regulations and character encoding. MessageBird SDK requires Node.js >= 0.10. (npm: messagebird, accessed January 2025)
Plivo's API supports Thailand SMS with features for handling Thai language and compliance requirements. Plivo Node.js SDK supports Node.js with environment variable authentication recommended. (npm: plivo, accessed January 2025)
Use a reputable SMS API provider like Twilio, Sinch, MessageBird, or Plivo. Pre-register your alphanumeric sender ID, ensure it's 11 characters or less, and format recipient numbers with +66. Remember to handle Thai language using UCS-2 encoding and comply with local regulations.
Several providers offer robust SMS APIs for Thailand, including Twilio, Sinch, MessageBird, and Plivo. Each offers features like pre-registered sender IDs, Thai language support (UCS-2 encoding), and compliance tools, though specific capabilities and pricing may vary.
Thailand restricts A2P (Application-to-Person) messaging to one-way communication. Businesses can send messages but cannot receive replies directly via SMS. This is a regulatory restriction enforced by the NBTC.
Marketing messages are allowed between 9 AM and 9 PM ICT (UTC+7). Avoid sending messages outside these hours to comply with local regulations. Consider Buddhist holidays and weekends when planning campaigns to maximize engagement.
Short codes are not available for international businesses in Thailand. They are reserved for domestic entities. International businesses should use pre-registered alphanumeric sender IDs instead.
Standard SMS messages use GSM-7 encoding for Latin characters, allowing 160 characters per segment. For Thai language and special characters, UCS-2 encoding is used, limiting messages to 70 characters per segment.
Alphanumeric sender IDs require pre-registration with a 2-week approval process. The sender ID must be 11 characters or less, match your registered business name, and avoid special characters. Contact your SMS API provider for registration assistance.
Restricted content includes gambling, adult material, political or religious content, financial loan solicitations, controlled substances, alcohol, and firearms. Financial services messages need a Bank of Thailand license, and URLs are prohibited in banking messages.
You must support both English and Thai opt-out keywords (STOP, CANCEL, HELP, and their Thai equivalents). Process opt-outs within 24 hours, send confirmation messages, and maintain suppression lists. Consent records must be kept for at least 3 months.
MMS messages are automatically converted to SMS with an embedded URL. The recipient can access the media content via this link. Avoid URL shorteners as they are prohibited; use full-length URLs instead.
The National Broadcasting and Telecommunications Commission (NBTC) regulates SMS communications in Thailand, enforcing strict guidelines for commercial messaging, content, and sender ID registration. They are the primary authority on SMS regulations.
The Personal Data Protection Act (PDPA) governs data handling. Obtain explicit consent before sending marketing messages, clearly state the messaging purpose, and maintain consent records for at least three months. Follow best practices for documentation and consent management.
Space out campaigns to avoid network congestion, respect quiet hours (9 PM - 9 AM), limit promotional messages to one per recipient per day, and ensure messages are localized with proper Thai language support and cultural sensitivity.
Sending SMS to landlines in Thailand is not possible. Attempts will result in a 400 response with error code 21614. Messages to landlines will not be logged and will not incur charges.
Number portability allows users to keep their numbers when switching carriers. It doesn't significantly impact SMS delivery as messages are routed correctly to the current operator.
Send SMS messages to Thailand mobile numbers with full regulatory compliance. This guide covers NBTC (National Broadcasting and Telecommunications Commission) regulations, PDPA (Personal Data Protection Act) requirements, and technical implementation for Thai SMS messaging. Learn how to register alphanumeric sender IDs, implement proper Thai language encoding (UCS-2), and integrate SMS APIs for Thailand's three major mobile carriers: AIS, DTAC, and True Move.
This guide covers compliance requirements, technical specifications, and production-ready code examples for Twilio, Sinch, MessageBird, and Plivo SDKs. Whether you're implementing authentication messages, marketing campaigns, or transactional notifications, you'll find essential information about time restrictions, opt-out management, and content filtering rules specific to Thailand's telecommunications ecosystem.
Thailand SMS Market Overview & Mobile Network Information
Market Conditions: Thailand operates a vibrant mobile market with high SMS adoption rates alongside popular OTT messaging apps like LINE and WhatsApp. Three major mobile operators – AIS, DTAC, and True Move – serve a predominantly Android user base (approximately 75% market share as of 2024). While OTT messaging apps dominate personal communications, SMS remains crucial for business communications, particularly authentication, notifications, and marketing due to its reliability and universal reach.
Note: Verify market share statistics with recent industry reports, as mobile market dynamics change frequently.
SMS Features and Technical Capabilities for Thailand
Thailand offers robust SMS capabilities with support for concatenated messages and alphanumeric sender IDs. Two-way messaging is not supported, and MMS requires URL conversion.
Two-Way SMS Support in Thailand (A2P Messaging)
Two-way SMS is not supported in Thailand for A2P (Application-to-Person) messaging. Use one-way messaging for your communications – you cannot receive replies from recipients.
Alternative approaches for customer responses:
Concatenated Messages (Segmented SMS)
Support: Yes, concatenation works for most sender ID types, though support may vary based on your specific sender ID.
Message length rules: Standard 160 characters per message segment using GSM-7 encoding.
Encoding considerations: Messages use GSM-7 encoding for Latin characters (160 characters) or UCS-2 for Thai language and special characters (70 characters per segment).
MMS Support
MMS messages automatically convert to SMS with an embedded URL link. When you send rich media content, the system generates a URL where recipients can access the media and includes this URL in the SMS message body. Use full-length URLs rather than shortened ones – URL shorteners are considered prohibited content in Thailand.
Recipient Phone Number Compatibility
Number Portability
Number portability is available in Thailand, allowing users to keep their phone numbers when switching between mobile operators. This feature does not significantly impact SMS delivery or routing, as messages route properly to the current carrier.
Sending SMS to Landlines
You cannot send SMS to landline numbers in Thailand. Attempts to send messages to landline numbers result in a 400 response with error code 21614. The message will not appear in logs, and your account will not be charged.
Validate mobile numbers before sending:
function isValidThaiMobile(phoneNumber: string): boolean { // Thai mobile numbers start with 6, 8, or 9 after country code const mobilePattern = /^\+66[689]\d{8}$/; return mobilePattern.test(phoneNumber); }Thailand SMS Compliance: NBTC Regulations & PDPA Requirements
Thailand's SMS communications are regulated by the National Broadcasting and Telecommunications Commission (NBTC), which enforces guidelines for commercial messaging. The Personal Data Protection Act (PDPA), effective May 2022, governs how businesses handle customer data and consent management. (NBTC Official Website | Thailand PDPA, accessed January 2025)
Important: The PDPA B.E. 2562 (2019) came into full enforcement on June 1, 2022. Maintain compliance with both NBTC telecommunications regulations and PDPA data protection requirements.
PDPA Consent Requirements for Thailand SMS Marketing
Explicit Consent Requirements:
Best Practices for Documentation:
HELP/STOP and Other Commands
Support both English and Thai opt-out keywords:
English keywords:
Thai keywords:
Implementation requirements:
Example HELP response structure:
Note: While there is no centralized opt-out standard in Thailand, implementing bilingual opt-out support is considered best practice for compliance and user experience.
Do Not Call / Do Not Disturb Registries
Thailand does not maintain a centralized Do Not Call registry. Maintain your own suppression lists:
Time Zone Sensitivity
Prohibited hours for marketing messages: 9 PM – 9 AM (ICT – UTC+7)
Exempt message types: Emergency and transactional messages are exempt from time restrictions.
Holiday considerations: Avoid sending marketing messages during major Buddhist holidays and weekends.
Validate sending time before dispatching:
function isValidSendingTime(): boolean { const now = new Date(); const bangkokTime = new Date(now.toLocaleString('en-US', { timeZone: 'Asia/Bangkok' })); const hour = bangkokTime.getHours(); // Marketing messages allowed between 9 AM and 9 PM return hour >= 9 && hour < 21; }Thailand SMS Sender ID Options: Alphanumeric, Long Codes & Short Codes
Alphanumeric Sender ID Registration for Thailand
Operator network capability: Fully supported
Registration requirements: Pre-registration required; 2-week approval process typically required
Sender ID preservation: Yes, displayed as registered
Additional requirements:
Important: Allow adequate lead time for sender ID registration before campaign launches. Registration timelines may vary by operator and may be longer during high-volume periods.
Long Codes
Domestic vs. International:
Sender ID preservation: No, international numbers are typically overwritten
Provisioning time: N/A for international businesses
Use cases: Not recommended for international businesses
Short Codes
Support: Not available for international businesses
Provisioning time: N/A
Use cases: Reserved for domestic entities only
Prohibited Content & Industry Restrictions for Thailand SMS
Prohibited Content and Industries:
Financial Services Restrictions:
Content Filtering
Carrier Filtering Rules:
Best Practices to Avoid Filtering:
Best Practices for Thailand SMS Campaigns & Delivery Optimization
Messaging Strategy
Structure your messages for clarity:
Message template examples:
Authentication/OTP:
Transactional notification:
Marketing message:
Bilingual message formatting:
Sending Frequency and Timing
Localization
Opt-Out Management
Testing and Monitoring
Test across all major carriers: AIS, DTAC, True Move
Monitor key metrics:
Regular testing:
Set up monitoring with recommended tools:
Thailand SMS FAQ: Common Questions & Answers
How long does it take to register an alphanumeric sender ID in Thailand?
Sender ID registration in Thailand typically requires a 2-week approval process. Allow adequate lead time before campaign launches, as timelines may vary by operator and extend during high-volume periods.
What character encoding should I use for Thai language SMS?
Use UCS-2 encoding for Thai language messages. UCS-2 provides 70 characters per SMS segment, compared to GSM-7 encoding which provides 160 characters for Latin characters only.
Can I send marketing SMS in Thailand at any time?
No. Prohibit marketing messages between 9 PM and 9 AM (ICT – UTC+7). Emergency and transactional messages are exempt from these time restrictions. Consider Buddhist holidays and weekends when planning campaigns.
Do I need PDPA compliance for SMS marketing in Thailand?
Yes. The Personal Data Protection Act (PDPA) came into full enforcement on June 1, 2022. Obtain written or electronic consent before sending marketing messages and maintain consent records for at least 3 months (recommended: retain for audit purposes).
Are URL shorteners allowed in Thailand SMS messages?
No. URL shorteners are automatically blocked by carriers in Thailand. Use full-length, registered URLs only. Register URLs with carriers before use to avoid filtering.
Which SMS providers support Thailand messaging?
Major SMS providers supporting Thailand include Twilio (Node.js 14-22 LTS), Sinch (@sinch/sdk-core with OAuth2/API Token), MessageBird (Node.js >= 0.10), and Plivo. All support Thai language encoding and pre-registered sender IDs.
Can I receive SMS replies in Thailand?
No. Two-way SMS is not supported for A2P (Application-to-Person) messaging in Thailand. Use one-way messaging only – you cannot receive replies from recipients.
What happens if I send SMS to a landline in Thailand?
Attempts to send SMS to landline numbers result in a 400 response with error code 21614. The message will not appear in logs, and your account will not be charged.
How do I implement opt-out functionality for Thailand SMS?
Support both English and Thai keywords: STOP/หยุด (stop), CANCEL/ยกเลิก (cancel), HELP/ช่วยเหลือ (help). Send confirmation messages in the same language as the opt-out request. Process commands within 24 hours and maintain your own suppression lists.
What content is prohibited in Thailand SMS messages?
Prohibited content includes gambling, adult content, political messaging, religious content, financial loan solicitations (without Bank of Thailand license), controlled substances, cannabis products, alcohol, and firearms. URLs are prohibited in banking/financial messages.
Thailand SMS API Integration: Twilio, Sinch, MessageBird & Plivo
Twilio SMS API for Thailand
Twilio provides robust SMS capabilities for Thailand through their REST API. Authentication uses your Account SID and Auth Token, with support for pre-registered sender IDs. Twilio Node.js SDK supports Node.js 14, 16, 18, 20, and 22 LTS as of January 2025. (npm: twilio, accessed January 2025)
import twilio from 'twilio'; // Initialize client with your credentials const client = twilio( process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN ); // Function to send SMS to Thailand async function sendThaiSMS( to: string, message: string, senderId: string ) { try { // Validate sending time for marketing messages if (!isValidSendingTime()) { throw new Error('Cannot send marketing messages between 9 PM and 9 AM ICT'); } // Ensure proper formatting for Thailand numbers const formattedNumber = to.startsWith('+66') ? to : `+66${to.substring(1)}`; const response = await client.messages.create({ body: message, from: senderId, // Must be pre-registered to: formattedNumber, // Optional parameters for delivery tracking statusCallback: 'https://your-webhook.com/status' }); console.log(`Message sent successfully: ${response.sid}`); return response; } catch (error) { console.error('Error sending message:', error); throw error; } } function isValidSendingTime(): boolean { const now = new Date(); const bangkokTime = new Date(now.toLocaleString('en-US', { timeZone: 'Asia/Bangkok' })); const hour = bangkokTime.getHours(); // Marketing messages allowed between 9 AM and 9 PM return hour >= 9 && hour < 21; }Handle delivery status webhooks:
import express from 'express'; const app = express(); app.use(express.urlencoded({ extended: false })); app.post('/status', (req, res) => { const { MessageSid, MessageStatus, ErrorCode } = req.body; console.log(`Message ${MessageSid}: ${MessageStatus}`); if (ErrorCode) { console.error(`Error ${ErrorCode} for message ${MessageSid}`); // Handle specific Thailand errors if (ErrorCode === '21614') { console.error('Attempted to send to landline number'); } } res.sendStatus(200); });Sinch SMS API for Thailand
Sinch offers SMS services with support for Thai language and pre-registered sender IDs. Use
@sinch/sdk-corefor OAuth2 or API Token authentication. The SDK supports all current Sinch APIs, including SMS API with region-specific configurations. (npm: @sinch/sdk-core | Sinch SMS API Docs, accessed January 2025)import { SinchClient } from '@sinch/sdk-core'; class ThaiSMSService { private client: SinchClient; constructor() { this.client = new SinchClient({ servicePlanId: process.env.SINCH_SERVICE_PLAN_ID, apiToken: process.env.SINCH_API_TOKEN, smsRegion: 'us' // Default region for SMS API }); } async sendMessage( to: string, message: string, senderId: string ) { try { const response = await this.client.sms.batches.send({ to: [to], from: senderId, body: message, // Note: Use 'unicode' or ensure proper encoding for Thai characters delivery_report: 'summary' }); return response; } catch (error) { console.error('Sinch SMS Error:', error); throw error; } } }MessageBird SMS API for Thailand
MessageBird provides SMS API access with specific support for Thailand's regulations and character encoding. MessageBird SDK requires Node.js >= 0.10. (npm: messagebird, accessed January 2025)
import messagebird from 'messagebird'; class ThaiMessageBirdService { private client: any; constructor() { this.client = messagebird(process.env.MESSAGEBIRD_API_KEY); } sendSMS( recipient: string, message: string, senderId: string ): Promise<any> { return new Promise((resolve, reject) => { this.client.messages.create({ originator: senderId, recipients: [recipient], body: message, datacoding: 'unicode', // For Thai language support type: 'flash' // Optional for urgent messages }, (err: any, response: any) => { if (err) { reject(err); } else { resolve(response); } }); }); } }Plivo SMS API for Thailand
Plivo's API supports Thailand SMS with features for handling Thai language and compliance requirements. Plivo Node.js SDK supports Node.js with environment variable authentication recommended. (npm: plivo, accessed January 2025)
import plivo from 'plivo'; class ThaiPlivoService { private client: any; constructor() { this.client = new plivo.Client( process.env.PLIVO_AUTH_ID, process.env.PLIVO_AUTH_TOKEN ); } async sendSMS( to: string, message: string, senderId: string ) { try { const response = await this.client.messages.create({ src: senderId, dst: to, text: message, url_strip_query_params: false, // Important for URL tracking powerpack_uuid: process.env.PLIVO_POWERPACK_ID // Optional for better routing }); return response; } catch (error) { console.error('Plivo Error:', error); throw error; } } }API Rate Limits and Throughput
Default rate limits vary by provider (typically 1-10 messages per second)
Implementation strategies:
Example rate limiting with retry logic:
import { Queue } from 'bullmq'; import Redis from 'ioredis'; const connection = new Redis({ host: process.env.REDIS_HOST, port: parseInt(process.env.REDIS_PORT || '6379'), maxRetriesPerRequest: null }); const smsQueue = new Queue('thailand-sms', { connection }); async function queueSMS(to: string, message: string, senderId: string) { await smsQueue.add('send-sms', { to, message, senderId }, { attempts: 3, backoff: { type: 'exponential', delay: 2000 }, removeOnComplete: true } ); }Note: Verify current rate limits with your SMS provider, as they may change based on account type and volume commitments.
Error Handling and Reporting
Implement comprehensive logging with Winston or similar tools.
Track delivery receipts via webhooks to monitor message status in real time.
Monitor common error codes:
Store message metadata for troubleshooting and audit compliance.
Complete error handling example:
import winston from 'winston'; const logger = winston.createLogger({ level: 'info', format: winston.format.json(), transports: [ new winston.transports.File({ filename: 'error.log', level: 'error' }), new winston.transports.File({ filename: 'combined.log' }) ] }); async function sendSMSWithErrorHandling( to: string, message: string, senderId: string ) { const metadata = { to, senderId, timestamp: new Date().toISOString(), messageLength: message.length }; try { const response = await sendThaiSMS(to, message, senderId); logger.info('SMS sent successfully', { ...metadata, messageSid: response.sid, status: response.status }); return response; } catch (error: any) { logger.error('SMS send failed', { ...metadata, errorCode: error.code, errorMessage: error.message, stackTrace: error.stack }); // Handle specific error codes if (error.code === 21614) { logger.warn('Attempted to send to landline', metadata); } throw error; } }Set up webhook endpoints for delivery status:
app.post('/webhook/delivery', express.json(), (req, res) => { const { messageSid, status, errorCode, to } = req.body; logger.info('Delivery status update', { messageSid, status, to, errorCode: errorCode || 'none' }); // Update your database with delivery status // Trigger alerts for failed deliveries res.sendStatus(200); });Recap and Additional Resources
Key Takeaways
Compliance Priorities
Technical Considerations
Next Steps
Official Resources
Additional Support
For technical assistance:
For compliance matters:
Developer communities: