Alphanumeric Sender ID

The alphanumeric sender ID allows the sender to send messages using a custom ID constructed from a combination of alpha (a-z, A-Z) and numeric (0-9) characters, as well as spaces. This makes the caller identifiable to the receiver and companies can set their brand name as the caller ID (e.g., “PLIVO”). This is optimal for sending SMS text messages as the receiver of the message will not be able to reply to a message sent with an alphanumeric sender ID.

You can send SMS text messages with alphanumeric sender IDs by changing the src parameters to alphanumeric characters and making an HTTP POST request to the Message API.

POST https://api.plivo.com/v1/Account/{auth_id}/Message/
Note: Alphanumeric sender ID is not allowed in some countries including US, Canada, and Brazil because of carrier regulations. Therefore, non-compliance to these local carrier regulations may prevent your messages from getting delivered.

Prerequisites

  1. Sign up for a free Plivo trial account.
  2. Check out our Helper Libraries page and install the right helper based on the programming language you want to use.
  3. Buy a Plivo phone number (optional).
    Note: A phone number is required only for sending SMS to US and Canadian phone numbers. However, country-specific carrier conditions may still apply. You can buy a US or Canadian phone number through the Buy Numbers tab on your Plivo account UI.
  4. Use a web hosting service to host your web application. There are many inexpensive cloud hosting providers that you can use for just a few dollars a month. Follow the instructions of your hosting provider to host your web application.
    Note: If you are using a Plivo Trial account for this example, you can only send sms to phone numbers that have been verified with Plivo. Phone numbers can be verified at the Sandbox Numbers page.

Implementation

  1. Copy the relevant code below into a text file and save it.
  2. Replace 'Your AUTH_ID' and 'Your AUTH_TOKEN' with the AUTH ID and AUTH TOKEN found on your Plivo dashboard.
  3. Add your 'src' (source) phone number. This will show up as your Sender ID. To create an alphanumeric sender ID, simply change the 'src' parameter to the alphanumeric ID you prefer (e.g., src: PLIVO). If you’re using a phone number, be sure that all phone numbers include country code, area code, and phone number without spaces or dashes (e.g., 14153336666).
    Note: You can send SMS text messages to any country using the Message API and set any ‘src’ number except for US and Canadian numbers. In order to send text messages to phones in the US or Canada, you will need to purchase a US or Canadian phone number from Plivo and use it as the ‘src’ number. You can buy a Plivo number from the Buy Numbers tab on your Plivo account dashboard.
  4. Add your 'dst' (destination) phone numbers. These are the phone numbers you wish to send SMS text messages to. To send multiple messages in a single API request, separate your destination phone numbers with the “<” character (e.g., 14156667777<14157778888<14158889999). Be sure that all phone numbers include country code, area code, and phone number without spaces or dashes (e.g., 14153336666).
    Note: If you are using a trial account, your destination number needs to be verified with Plivo. Phone numbers can be verified at the Sandbox Numbers page.
  5. Edit the 'text' field with your SMS text message.
    Note: text messages that are longer than 160 characters are concatenated and billed separately as individual text messages.
  6. Make the 'HTTP POST' request to Plivo. If successful, Plivo will queue your SMS deliver it to your recipients at a base rate of 1 message per second.
    Advanced hack: Check out our full Message API docs to see all the parameters and functionalities you can use.

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import plivo

auth_id = "Your AUTH_ID"
auth_token = "Your Auth_TOKEN"

p = plivo.RestAPI(auth_id, auth_token)

params = {
    'src': 'ALPHA-ID', # Alphanumeric sender ID
    'dst' : '1111111111', # Receiver's phone number with ountry code
    'text' : "Hi, text from Plivo" # Your SMS text message
}

response = p.send_message(params)

# Prints the complete response
print str(response)

# Prints only the status code
# print response[0]

# Prints the message details
# print response[1]
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'rubygems'
require 'plivo'
include Plivo

AUTH_ID = "Your AUTH_ID"
AUTH_TOKEN = "Your AUTH_TOKEN"

p = RestAPI.new(AUTH_ID, AUTH_TOKEN)

# Send SMS
params = {
    'src' => 'ALPHA-ID', # Sender's Alphanumeric sender ID
    'dst' => '1111111111', # Receiver's phone Number with country code
    'text' => 'Hi, text from Plivo' # Your SMS Text Message - English
    }

response = p.send_message(params)
puts response

# Prints only the status code
# puts response[0]

# Prints the message details
# puts response[1]
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
var plivo = require('plivo');
var p = plivo.RestAPI({
  authId: 'Your AUTH_ID',
  authToken: 'Your AUTH_TOKEN'
});

var params = {
    'src': 'ALPHA-ID', // Alphanumeric sender ID
    'dst' : '2222222222', // Receiver's phone Number with country code
    'text' : "Hi, text from Plivo" // Your SMS Text Message - English
};

// Prints the complete response
p.send_message(params, function (status, response) {
    console.log('Status: ', status);
    console.log('API Response:\n', response);
});
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<?php
    require 'vendor/autoload.php';
    use Plivo\RestAPI;
    $auth_id = "Your AUTH_ID";
    $auth_token = "Your AUTH_TOKEN";
    $p = new RestAPI($auth_id, $auth_token);
    // Send a message
    $params = array(
            'src' => 'ALPHA-ID', // Sender's Alphanumeric ID
            'dst' => '447441906862', // Receiver's phone number with country ode
            'text' => 'Hi, text from Plivo' // Your SMS text message
        );
    $response = $p->send_message($params);
    // Print the response
    print_r ($response['response']);
?>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.plivo.test;

import java.util.LinkedHashMap;
import com.plivo.helper.api.client.*;
import com.plivo.helper.api.response.message.MessageResponse;
import com.plivo.helper.exception.PlivoException;

public class SendAlphanumeric {
    public static void main(String[] args) {
        String authId = "Your AUTH_ID";
        String authToken = "Your AUTH_TOKEN";
        RestAPI api = new RestAPI(authId, authToken, "v1");

        LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>();
        parameters.put("src", "ALPHA-ID"); // Alphanumeric Sender ID
        parameters.put("dst", "1111111111"); // Receiver's phone number with country code
        parameters.put("text", "Hi, text from Plivo"); // Your SMS text message

        try {
            // Send the Message
            MessageResponse msgResponse = api.sendMessage(parameters);
            // Print the response
            System.out.println(msgResponse);
            // Print the Api ID
            System.out.println("Api ID : " + msgResponse.apiId);
            // Print the Response Message
            System.out.println("Message : " + msgResponse.message);
            if (msgResponse.serverCode == 202) {
                // Print the Message UUID
                System.out.println("Message UUID : " + msgResponse.messageUuids.get(0).toString());
            } else {
                System.out.println(msgResponse.error);
            }
        } catch (PlivoException e) {
            System.out.println(e.getLocalizedMessage());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Reflection;
using RestSharp;
using Plivo.API;

namespace Send_Alpha
{
    class Program
    {
        static void Main(string[] args)
        {
            RestAPI plivo = new RestAPI("Your AUTH_ID", "Your AUTH_TOKEN");

            IRestResponse<MessageResponse> resp = plivo.send_message(new Dictionary<string, string>()
            {
                { "src", "ALPHA" }, // Alphanumeric sender ID
                { "dst", "1111111111" }, // Receiver's phone number wiht country code
                { "text", "Hi, text from plivo" } // Your SMS text message
            });

            // Prints the message details
            Console.Write(resp.Content);

            // Print the API ID
            // Console.WriteLine("Api ID : {0}", resp.Data.api_id);

            // Print the Message UUID
            // Console.WriteLine("Message UUID : {0}", resp.Data.message_uuid[0]);

            Console.ReadLine();
        }
    }
}
1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"src": "ALPHA-ID","dst": "1111111111", "text": "Hi, text from Plivo"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Message/

Sample Response

(202,
    {
        u'message': u'message(s) queued',
        u'message_uuid': [u'53e6526a-8a7a-11e4-a77d-22000ae383ea'],
        u'api_id': u'53cc4532-8a7a-11e4-96e3-22000abcb9af'
    }
)

Next Step

Learn how to receive an inbound SMS.

  1. Send a Single SMS
  2. Send a Long SMS
  3. Send Multiple (Bulk) SMS

  4. Receive an SMS
  5. Reply to an Incoming SMS
  6. Forward an Incoming SMS
  7. Get Details of all Messages
  8. Get Details of a Single Message
  9. Handling SMS Delivery Reports
  10. Forward SMS to Email