Reputation: 31
I've managed to get my SNS service working in PHP laravel but the issue I have is that I can only send to one number.
I've used the following:
$sms = AWS::createClient('sns');
$sms->publish([
'Message' => $content,
'PhoneNumber' => '+123456789',
'MessageAttributes' => [
'AWS.SNS.SMS.SMSType' => [
'DataType' => 'String',
'StringValue' => 'Transactional',
]
],
]);
The phone number has to be a string, I really do not want to put this inside a for loop for each number and I can't find anything using PHP specifically about sending to multiple phone numbers. Any help would be appreciated!
Upvotes: 2
Views: 1055
Reputation: 31
Hey guys so for anyone interested I managed to find a way to do this. I create a Job queue which I passed the array of phone numbers as well as the content of the message, and then in the handle method in the job just looped through the phone numbers with my above method and it worked perfectly.
Upvotes: 1