Question:
For some reason the SenderID seems to revert to NOTICE – see here when I set the SenderID in the code.
When I leave the SenderID variable out, it sends as the default set – this is good, but we will be occasionally changing the name for different uses.
I am using the Official PHP SDK, with the code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$aws_cred = array( 'credentials' => array( 'key' => 'GOT THE KEY', 'secret' => 'GOT THE SECRET', ), 'region' => 'eu-west-1', // < your aws from SNS Topic region 'version' => 'latest' ); $sns = new \Aws\Sns\SnsClient($aws_cred); $args = array( "SenderID" => "MySendID", "SMSType" => "Promotional", "Message" => "Amazon y u do dis??", "PhoneNumber" => "+number" ); $result = $sns->publish($args); |
I am sending to the UK (so SID works there), and also it is within the 11 character limit.
Does anyone have any idea why this is happening?
Cheers
Answer:
I have found the answer.
The search system didn’t materialise this originally, but finally, I have found it.
QUOTE FROM: https://stackoverflow.com/a/43748448/7586984
I found the solution. Set the args this way. It works!
123456789101112 $args = array('MessageAttributes' => ['AWS.SNS.SMS.SenderID' => ['DataType' => 'String','StringValue' => 'YourSenderName']],"SMSType" => "Transactional","PhoneNumber" => "+87654321","Message" => "Hello World!");