How can I receive SMS messages on my Plivo numbers?

Prerequisites

  1. Sign up for a free Plivo trial account or log in to your Plivo account. 
  2. Check out our Server SDKs page for information on how to install the SDK for the programming language you want to use.
  3. Buy a Plivo phone number. You must have a phone number to receive and reply to SMS text messages. You can buy a Plivo phone number in available countries by visiting Phone Numbers > Buy Numbers. Check the SMS API coverage page for supported countries.
  4. Use a web hosting service to host your web application. Many inexpensive cloud hosting providers cost just a few dollars a month. Follow the instructions of your hosting provider to host your web application.

Set up a web server

For this example, let’s assume your web server is located at http://example.com. The following snippet will set up a route on your web server. Now, when we send an HTTP request to http://example.com/receive_sms, this route will be triggered.

Create an application

  1. Create an application by either visiting Voice > XML and clicking on Add New Application, or by using Plivo’s Application API.
  2. Give your application a name. For this example, let’s call it Receive SMS. Enter your server URL (for example http://example.com/receive_sms) in the message URL field and set the method to POST. See our Application API reference guide to learn how to modify your application through our APIs.
  3. Click on Create Application to save your application.

app.png

Assign a Plivo number to your app

  1. Navigate to the Phone Numbers page and select the phone number you want to use for this app.
  2. Select Receive SMS (the name of the app) from the Plivo App drop-down list.
  3. Click on Update Number to save.

num.png

If you don’t have a number, go to Phone Numbers > Buy Numbers to purchase a Plivo phone number.

buy.png

Test it

Send an SMS to your Plivo number using a regular mobile phone. Plivo will send a request with message attributes to your Message URL.

Was this article helpful?
0 out of 0 found this helpful
Didn’t find what you are looking for? Create new ticket