Muhammed Ramees
Muhammed Ramees

Reputation: 1

AWS php SDK issue while using for Pinpoint t sms

When I use AWS php SDK for pinpoint sms api sometimes it's getting sms from a number other than AWS not that the same content that I have given. and I think it's not from AWS , how to solve this and anyone had the same experience ?

Once I tried to change the AWS keys but still same , so where will be the issue,

this is my code

public function handle()
{
    $region = config('aws_default_region');
    $key = config('aws_sms_access_key_id');
    $secret = config('aws_sms_secret_access_key');
    $projectId = config('aws_sms_project_id');
    $credentials = [
        'key' => $key,
        'secret' => $secret,
    ];

    $client = new PinpointClient([
        'version' => 'latest',
        'region' => $region,
        'credentials' => $credentials,
    ]);
        $configuation = [
            'SMSMessage' => [
                'Body' => $this->message,
                'MessageType' => 'TRANSACTIONAL',
                'SenderId' => 'TESTID'
            ],
        ];
    // Specify the parameters for sending the SMS message
    $params = [
        'ApplicationId' => $projectId,
        'MessageRequest' => [
            'Addresses' => [
                $this->contactNumber => [
                    'ChannelType' => 'SMS',
                ],
            ],
            'MessageConfiguration' => $configuation,
        ],
    ];

    try {
        $result = $client->sendMessages($params);
    } catch (AwsException $e) {
        Log::error('AWS Pinpoint Error:', ['error' => $e->getMessage()]);
    }
}

Upvotes: 0

Views: 9

Answers (0)

Related Questions