I can’t send Short Message Service (SMS) text to Indian numbers through Amazon Simple Notification Service (Amazon SNS) using sender ID.
Short description
When you send messages to recipients in India, by default Amazon SNS uses International Long Distance Operator (ILDO) routes to transmit those messages. These messages look as if they were sent from random numeric IDs.
Note: If you're using the ILDO connection for India, the price for sending text messages is higher than the local route.
To send messages over local routes, use a pre-registered alphabetic sender ID when publishing SMS messages using SNS. Make sure to register the use case and message templates with the Telecom Regulatory Authority of India (TRAI) through Distributed Ledger Technology (DLT) portals. For more information, see Sender ID registration requirements for India. You can send the text messages with the registered sender ID by using the SNS Publish API request.
Note:
- When you publish a message using the Amazon SNS console, use country-specific attributes for India such as Entity ID and Template ID.
- When using the SNS Publish API, add the MessageAttributes parameter to set values such as AWS.MM.SMS.EntityId and AWS.MM.SMS.TemplateId. For more information, see Sending a message (AWS SDKs).
Resolution
Follow these steps to isolate and troubleshoot the SMS delivery issues while using sender ID.
Verify the AWS Region where the sender ID is registered and the AWS Region used for sending text messages
SNS service supports sender IDs in several Regions, see Supported Regions and countries. Send the messages using the same AWS Region where the sender ID was registered.
Make sure to include the correct sender ID along with the corresponding EntityId and TemplateId
Verify that the EntityId and TemplateId are correct. Check with the values received from DLT portal.
Example Python(Boto3) Publish API call:
import boto3
client = boto3.client('sns')
response = client.publish(
PhoneNumber='+91xxxxxxxxxx',
Message="Registered Test Message",
MessageAttributes={
'AWS.MM.SMS.EntityId': {
'DataType': 'String',
'StringValue': '<EntityId>'
},
'AWS.MM.SMS.TemplateId': {
'DataType': 'String',
'StringValue': '<TemplateId>'
},
'AWS.SNS.SMS.SenderID': {
'DataType': 'String',
'StringValue': '<SenderID>'
},
'AWS.SNS.SMS.SMSType': {
'DataType': 'String',
'StringValue': 'Transactional'
}
}
)
Note: Replace <EntityId> with your registered entity ID, <TemplateId> with your registered template ID, and <SenderID> with your registered sender ID. For other languages, see the corresponding language-specific AWS SDKs page.
Turn on Amazon CloudWatch logs and then view the SMS delivery logs
For more information, see How do I access Amazon SNS topic delivery logs for SMS messages? From SMS delivery logs, check these providerResponse notifications:
- Phone has blocked SMS
- Blocked as spam by phone carrier
- Phone carrier blocked this message
The carriers and providers might block messages if the message content doesn't match the template registered in the DLT portal. Or, they might block messages if it contains characters distinct from the registered template. For more information, see the reasons that carriers might block the SMS messages and template matching issues.
Check for downstream provider and carrier issues
To troubleshoot potential downstream issues, create a support case for Amazon SNS. Provide the following information in the support case:
- The AWS Region where you registered the sender ID to send SMS messages
- The CSV file from the DLT portal that contains the registered template
- Three or four samples of SMS logs. The logs include message IDs (along with timestamp and time zone) of failed SMS messages for each of the different numbers. These log samples can't be older than 48 to 72 hours.
Note: In India, promotional SMS messages can be delivered only from 9 AM to 9 PM, Indian Standard Time (IST). Any messages sent outside of this time frame might result in non-deliveries.