I'm having trouble digging through the documentation for Amazon's AWS PHP-sdk.
Basically, I just need to send a standard text message to a number. I know it is possible because amazon allows you to send messages through the console directly via this screen:
It says something about using the "publish" method, but looking through that documentation really didn't provide any answers. #Publish documentation link
Any help or guidance is appreciated. I am currently looking for a solution that uses V2 of the sdk.
Thanks in advance.
If you are using AWS SDK version prior to 3.0, you still have create a topic and subscribe with an SMS type. But from 3.0 onward, you could send SMS direct to a number.
To use the Publish action for sending a message to a mobile endpoint, such as an app on a Kindle device or mobile phone, you must specify the EndpointArn.
Hope this help for people who still using PHP AWS SDK v2
Same question: https://stackoverflow.com/a/51208701/551559
You would need to add new parameter in the source code.
No where have a doc showing it to use with PHP. Reading the Java and C# sdk I wrote the PHP version that works.
Updated on dec 20 '18
The args passed to
publish
method now have a new format. Fixed!How to send a SMS over AWS using PHP
First install aws/aws-sdk-php. Using composer:
composer require aws/aws-sdk-php
Create a php file with:
The result must have one array with many data, including MessageId.
Somehow Tiago's answer didn't work for me. So I had a look at the publish API from AWS-SDK. Seems like there are no parameters of
SMSType
&SenderID
in publish method. Check here -https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sns-2010-03-31.html#publish
So if you want to override these parameters, the following variation of Tiago's code should work fine -