Unicode を含む SMS の送信
Nexmo の SMS 用 API は、中国語、日本語、韓国語での通信時に必要となる Unicode 文字もサポートしています。
Unicode 文字を含む SMS を送信するには、以下の例の次の変数を置き換えます。
| キー | 説明 |
|---|---|
TO_NUMBER | SMS の送信先番号 (例: 447700900000)。 |
NEXMO_API_KEY | Nexmo Dashboard でご確認ください。 |
NEXMO_API_SECRET | Nexmo Dashboard でご確認ください。 |
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named send-unicode-sms.js and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
Create a class named SendUnicodeMessage and add the following code to the main method:
Run your code
We can use the application plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.sms with the package containing SendUnicodeMessage:
Prerequisites
Add the following to build.gradle:
Create a class named SendUnicodeMessage and add the following code to the main method:
Run your code
We can use the application plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.sms with the package containing SendUnicodeMessage:
Prerequisites
Create a file named SendSmsWithUnicode.cs and add the following code:
Add the following to SendSmsWithUnicode.cs:
Prerequisites
Create a file named send-unicode-sms.php and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named send-unicode-sms.rb and add the following code:
Run your code
Save this file to your machine and run it:
試行手順
上記例を実行すると、指定した携帯電話番号に Unicode 文字を含むメッセージが正常に送信されます。
Unicode メッセージの最大文字数は通常のメッセージの 160 でなく 70 であることにご注意ください。この点に関する詳細についてはヘルプページを参照してください