how to send text to US numbers in Nexmo

前端 未结 2 1347
天涯浪人
天涯浪人 2021-01-17 04:04

Sending message to Philippines is simple as pie.

But in US numbers, I\'ll have to go through verification that I do not know how.

I started 2F Authenticatio

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-17 04:40

    You can use Nexmo's SMS API which allows you to send a text in over 200 countries with a simple HTTP call.

    You can sign up for a virtual number which allows you to send SMS messages & receive incoming message as well.

    For 2FA, you can use the Verify API to authenticate users to a specific device.

    This method is more secure than using an SMS API and randomly generating numbers yourself. The pin will then entered by the end user & checked by the Verify API.

    It takes a few lines of code to use either of these APIs. Below is a block of code in PHP which allows you to send a text using the SMS API.

     API_KEY,
        'api_secret' => API_SECRET,
        'to' => YOUR_NUMBER,
        'from' => NEXMO_NUMBER,
        'text' => 'Hello from Nexmo'
    ]);
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    

    Here is the documentation for Nexmo's SMS API for reference.

    Here is the documentation for Nexmo's Verify API if you were looking for a simple 2FA solution.

提交回复
热议问题