I'm using AWS SDK 3.0 to send SMS via AWS SNS for indian numbers. I've ec2 instance created on AWS. Please refer the code below :
$params = array( 'credentials' => array( 'key' => 'XXXXXX', 'secret' => 'XXXXXXX', ), 'region' => 'us-west-2', // < your aws from SNS Topic region 'version' => 'latest', 'http' => [ 'verify' => false ] ); $sns = new \Aws\Sns\SnsClient($params); $args = array( 'MessageAttribute' => [ 'AWS.SNS.SMS.SenderID' => [ 'DataType' => 'String', 'StringValue' => 'Sender', ], 'AWS.SNS.SMS.SMSType' => [ 'DataType' => 'String', 'StringValue' => 'Transactional', ] ], "Message" => "Test Message", "PhoneNumber" => "+91XXXXXX", 'MessageStructure' => 'string', ); $result = $sns->publish($args);
This code is sending SMS. However, the SMS are getting logged as Promotional SMS instead of Transactional. Thus getting delivered between 9am to 8pm only.
Any help is much appreciated.