Search code examples
apilaravel-4vonage

Nexmo not sending to US numbers


Framework: Laravel 4.2

API: Nexmo

Library: christian-giupponi/nexmo https://github.com/ChristianGiupponi/Laravel-4-Nexmo

I have already deposit $10 in my account which means its not demo anymore.

<?php

        $response = Nexmo::sendSMS('Amazon Company', $text_data['contact_number'], $text_data['text']); 
        $response = json_decode($response);

        if(isset($response->body->messages[0]->{'error-text'}))
        {
            return array(  
                'status'   => 'fail',
                'response' => $response->body->messages[0]->{'error-text'} 
            );
        }

        return array(  
            'status'  => 'success'  
        );
?>

My research:

  • I have tried sending to Philippine number, I successfully received the text message
  • I have tried sending to US number, but I did not receive any text message, I don't know why.

Solution

  • To send SMS to US numbers, You have to request short code or you have to registered long number. For more details you can check my answer on following link:

    https://stackoverflow.com/a/33035811/3077339

    Hope this will help you.