RapidAPI logo

Nexmo SMS Messaging

フリーミアム
開発者 nexmoOfficial
更新日 13日前
SMS
9.2/10
人気度
634ms
レイテンシ
100%
正常稼働率

「Nexmo SMS Messaging 」のドキュメント

ANNOUNCEMENT: Nexmo SMS API currently only available to send SMS messages to countries that don't require a virtual number. (Ex/ Japan)

Nexmo's SMS API allows you to send and receive text messages to users around the globe through simple RESTful APIs.

全文を表示する
SMS
POSTSend an SMS
Pricing
GETPricing by Country Code
GETPricing by Phone Number
Testing
POSTAdd Headers
POSTTest
GETSearch Numbers
POSTSend an SMS

Nexmo's SMS API allows you to send and receive text messages to users around the globe through simple RESTful APIs.

ヘッダーパラメータ
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
必須パラメータ
fromSTRING
REQUIREDThe name or number the message should be sent from. Alphanumeric senderID's are not supported in all countries, see Global Messaging (https://developer.nexmo.com/messaging/sms/guides/global-messaging#country-specific-features) for more details.
toSTRING
REQUIREDThe number you are sending the SMS to in E.164 format. For example 447700900000. (Requires the country code prefix)
パラメータ(Option)
textSTRING
OPTIONALThe body of the message being sent. If your message contains characters that can be encoded according to the GSM Standard and Extended tables then you can set the type to text. If your message contains characters outside this range, then you will need to set the type to unicode.
typeSTRING
OPTIONALAdvanced: The format of the message body. Must be one of: text, binary, wappush, unicode, vcalorvcard
ttlNUMBER
OPTIONALAdvanced: The duration in milliseconds the delivery of an SMS will be attempted. By default Nexmo attempt delivery for 72 hours, however the maximum effective value depends on the operator and is typically 24 - 48 hours. We recommend this value should be kept at its default or at least 30 minutes. Must be between 20000 and 604800000
messageclassNUMBER
OPTIONALAdvanced: The Data Coding Scheme value of the message Must be one of: 0, 1, 2 or 3
vcardSTRING
OPTIONALAdvanced: A business card in vCard format(https://en.wikipedia.org/wiki/VCard) . Depends on type parameter having the value vcard.
vcalSTRING
OPTIONALAdvanced: A calendar event in vCal format (https://en.wikipedia.org/wiki/VCal). Depends on type parameter having the value vcal.
bodySTRING
OPTIONALAdvanced: Hex encoded binary data. Depends on type parameter having the value binary.
udhSTRING
OPTIONALAdvanced: Your custom Hex encoded User Data Header (https://en.wikipedia.org/wiki/User_Data_Header). Depends on type parameter having the value binary.
protocolIdNUMBER
OPTIONALAdvanced: The value of the protocol identifier (https://en.wikipedia.org/wiki/GSM_03.40#Protocol_Identifier) to use. Ensure that the value is aligned with udh.
titleSTRING
OPTIONALAdvanced: The title for a wappush SMS. Depends on type parameter having the value wappush.
urlSTRING
OPTIONALAdvanced: The URL of your website. Depends on type parameter having the value wappush.
validitySTRING
OPTIONALAdvanced: The availability for an SMS in milliseconds. Depends on type parameter having the value wappush.
clientRefSTRING
OPTIONALAdvanced: You can optionally include your own reference of up to 40 characters.
コードスニペット
unirest.post("https://nexmo-nexmo-messaging-v1.p.rapidapi.com/send-sms")
.header("X-RapidAPI-Host", "nexmo-nexmo-messaging-v1.p.rapidapi.com")
.header("X-RapidAPI-Key", "ログインしてキーを取得")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
サンプルレスポンス
概要
リクエストURL: https://nexmo-nexmo-messaging-v1.p.rapidapi.com/send-sms
リクエストメソッド: POST
レスポンスヘッダ
レスポンスボディ

SDKをインストール(NodeJS)

インストール

Node.jsでUnirestを使用するには、NPMモジュールをインストールしてください。

$ npm install unirest

インストール完了後は、簡単にリクエストを行うことができるようになります。

var unirest = require('unirest');

リクエスト

unirest.post("https://nexmo-nexmo-messaging-v1.p.rapidapi.com/send-sms")
.header("X-RapidAPI-Host", "nexmo-nexmo-messaging-v1.p.rapidapi.com")
.header("X-RapidAPI-Key", "ログインしてキーを取得")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2認証
クライアントID
クライアントシークレット
OAuth2認証