HTTP API

The HTTP API is used to send simple SMS text messages by posting the message content and recipient information in a long URL.

Base URI

https://secure.telemessage.com

Endpoint

POST /jsp/receiveSMS.jsp

Sends a message via TeleMessage service.

Request

Provide the sending user’s authentication details and the message contents.

Parameter Name Description
userid
TeleMessage Account username
password
TeleMessage Account password
to
mobile destination number in international format
text
message body

 

Notes:

  • All parameters must be URL encoded, i.e. space is encoded into %20 or & to %26. For more info about URL encoding click here.
  • Destination should be formatted in international format, e.g. US phone number 718-1234-567, should be sent as 17181234567. 

Response

Http Status (String)

OK or Failed

Full status explanation in the table below: 

HTTP Status

Status Description
Failed: message is empty Message text is empty
Failed: wrong username/password Invalid user name/password (can be also invalid user stat: suspended/deleted etc)
Failed: user not allowed to use this method Only authorize users can send via this page
Failed: invalid destination Destination number is invalid or not supported
Failed: service error General error
OK Message Sent

 

HTTP Example

https://secure.telemessage.com/jsp/receiveSMS.jsp?userid=mylogin&password=12345678&to=17181234567&text=see%20you%20later

Let’s see it implemented in Java. We use HttpClient 4.3 to send message.

Note: When using HttpClient, you don’t need to encode parameters. HttpClient does it for you. 

package examples.url;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.impl.client.HttpClients;

import java.io.IOException;

/**
 * @author Grinfeld Mikhail
 * @since 10/27/2014.
 */
public class HttpGetURL {
    public static void main(String...args) {
        try {
            RequestBuilder builder = RequestBuilder.get().setUri("https://secure.telemessage.com/jsp/receiveSMS.jsp");
            builder.addParameter("userid", "john_donne");
            builder.addParameter("password", "12345678");
            builder.addParameter("to", "1xxxxxxxxx");
            builder.addParameter("text", "Hello TeleMessage");

            HttpResponse resp = HttpClients.createDefault().execute(builder.build());

            if (resp != null && resp.getStatusLine().getStatusCode() == 200) {
                resp.getEntity().writeTo(System.out);
            } else {
                System.out.println("Failed to send message");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}

 

**The correct syntax for sending messages in UNIX/LINUX is “https://secure.telemessage.com/jsp/receiveSMS.jsp?userid=mylogin&password=12345678&to=17181234567&text=see%20you%20later” with quotation marks around the entire post. 

 

Note: in order to send an IP Push Notification, you would send the message as if you were sending an SMS. TeleMessage checks if the recipient has the application. If so, the message will then be sent as an IP Push Notification. Please configure whether you want to send IP Push Notifications only, or enable SMS Fallback to ensure that messages will be delivered to the recipient in case the IP Push Notification fails via the TeleMessage web portal

 

Learn more about how the HTTP API is used to Send a One Time Password (OTP) to Authenticate Checkpoint Firewalls.

 

Explore additional code samples & developer resources: JAVA LibraryPHP LibraryREST APISOAP APIXML API, and more