how to send text to US numbers in Nexmo

2020-05-01 08:58发布

问题:

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 Authentication but seems that I dont know how to do next.

My question: How to add send text to US numbers in Nexmo?

回答1:

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.

<?php
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query([
'api_key' => 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.



回答2:

For US, you have to create one short code from you nexmo account and you have to specify your message template and with dynamic changeable max 2 variables and some basic contact information.

You can follow steps: Login into your nexmo account-> Products -> Short codes -> Add Shared Short Code -> Alert or Two factor authentication -> fill out form with require data -> wait for approval.

Alert: to just send one way alert message to users. Two facetor authentication: to verify user.

you can review following links for more detail

https://docs.nexmo.com/index.php/US-shared-short-code-api

https://help.nexmo.com/hc/en-us/articles/204017023-USA-Direct-route-Features-Restrictions

you can same links for other countries also.

EDIT:

In addition to this request, They will ask you few questions about how you are gonna use this service? , How user will get SMSs and how many times? etc.

After you providing such information they will approve your request.