Send and Receive SMS Messages

Level: Beginner

In this Learning Lab, you'll create an app that will send and receive SMS messages.

Objective

Completion Time: 10 minutes

  • Learn how to send an SMS message using Tropo
  • Create an SMS auto-responder with Tropo

Prerequisites

Create The Application

  1. From the Tropo dashboard, log into your account and click Create New App.

  2. Name your app 'Send and Receive SMS Messages'.

  3. Select Scripting API under the Type of Application.

  4. Open the script editor by clicking the pencil icon titled New script.

    The first step in writing this app is to create a call method. Set the telephone number to a number that can receive SMS messages, such as your mobile phone.

    event = call("+1916xxxxxxx", { network: "SMS"});
    

    When a message is received by this script, the call method will initiate a message to the specified number, using the SMS network.

  5. Use the say method to specify the message you want to send in response to incoming messages.

    event.value.say("This is a test message.");
    
  6. Save the file as 'sendmessage.js'.

  7. Choose United States or Canada and a Region in order to attach a phone number to your application.

    You need to use a U.S. or Canadian phone number with this application, otherwise there is no "transport" for the SMS to use for delivery. U.S. numbers can be used to reach U.S. destinations; the Canadian numbers should be used for elsewhere in the world.

  8. Click CREATE APP.

  9. On the next screen you'll be shown your app phone number. If no number is shown, repeat Step 6.

    Note: Provisioning new numbers may take a few minutes. If your app doesn't work immediately, wait a few minutes and try again.

  10. Send a text message to the phone number associated with your new application. You'll receive the message you created in Step 5 in response.