com.hoiio.sdk.services
Class SmsService

java.lang.Object
  extended by com.hoiio.sdk.services.HttpService
      extended by com.hoiio.sdk.services.SmsService

public class SmsService
extends HttpService

The SMS API allows developers to send/receive SMS to/from more than 200 countries around the world at a very competitive rate.

For more info please refer to: http://developer.hoiio.com/docs/sms.html


Constructor Summary
SmsService(String appId, String accessToken)
          Constructs the service to make all Sms requests
 
Method Summary
 SmsHistory fetchHistory()
          Retrieves the history of SMS sent or received by this application.
 SmsHistory fetchHistory(Date from, Date to, Integer page)
          Retrieves the history of SMS sent or received by this application.
 SmsRate fetchIncomingRate(String incoming)
          Retrieves the billable rate that will be charged for each multipart SMS message received
 SmsRate fetchOutgoingRate(String dest)
          Retrieves the billable rate that will be charged for each multipart SMS message sent
 SmsRate fetchOutgoingRate(String dest, String msg)
          Retrieves the billable rate that will be charged for each multipart SMS message sent
 Sms fetchSms(String txnRef)
          Fetches the current status of a SMS sent previously
 SmsTxn send(String dest, String msg)
          Sends SMS to mobile numbers in over 200 countries
 SmsTxn send(String dest, String msg, String senderName, String tag, String notifyUrl)
          Sends SMS to mobile numbers in over 200 countries
 BulkSmsTxn sendBulk(List<String> dests, String msg)
          Sends SMS in bulk (up to 1000 messages) to any mobile numbers in more than 200 countries
 BulkSmsTxn sendBulk(List<String> dests, String msg, String senderName, String tag, String notifyUrl)
          Sends SMS in bulk (up to 1000 messages) to any mobile numbers in more than 200 countries
 BulkSmsTxn sendBulk(String dest, String msg)
          Sends SMS in bulk (up to 1000 messages) to any mobile numbers in more than 200 countries
 BulkSmsTxn sendBulk(String dest, String msg, String senderName, String tag, String notifyUrl)
          Sends SMS in bulk (up to 1000 messages) to any mobile numbers in more than 200 countries
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmsService

public SmsService(String appId,
                  String accessToken)
Constructs the service to make all Sms requests

Parameters:
appId - AppID of the developer
accessToken - AccessToken of the developer
Method Detail

fetchHistory

public SmsHistory fetchHistory()
                        throws HoiioException
Retrieves the history of SMS sent or received by this application.

Returns:
Object containing all the responses from the server
Throws:
HoiioException

fetchHistory

public SmsHistory fetchHistory(Date from,
                               Date to,
                               Integer page)
                        throws HoiioException
Retrieves the history of SMS sent or received by this application.

Parameters:
from - (optional) Retrieve SMS history made by this app starting from this date/time in "YYYY-MM-DD HH:MM:SS" (GMT+8) format. E.g. "2010-01-01 00:00:00". If omitted, SMS history will be retrieved from the earliest transaction.
to - (optional) Retrieve SMS history made by this app before this date/time in "YYYY-MM-DD HH:MM:SS" (GMT+8) format. E.g. "2010-01-01 00:00:00". If omitted, SMS history will be retrieved up to the current point of time.
page - (optional) Each request returns a maximum of 100 entries. This parameter indicates which subset of entries to return.
Returns:
Object containing all the responses from the server
Throws:
HoiioException

fetchIncomingRate

public SmsRate fetchIncomingRate(String incoming)
                          throws HoiioException
Retrieves the billable rate that will be charged for each multipart SMS message received

Parameters:
incoming - Your Hoiio number to receive incoming SMS.
Returns:
Object containing all the responses from the server
Throws:
HoiioException

fetchOutgoingRate

public SmsRate fetchOutgoingRate(String dest)
                          throws HoiioException
Retrieves the billable rate that will be charged for each multipart SMS message sent

Parameters:
dest - The recipient number of the SMS. Phone numbers should start with a "+" and country code (E.164 format), e.g. +6511111111.
Returns:
Object containing all the responses from the server
Throws:
HoiioException

fetchOutgoingRate

public SmsRate fetchOutgoingRate(String dest,
                                 String msg)
                          throws HoiioException
Retrieves the billable rate that will be charged for each multipart SMS message sent

Parameters:
dest - The recipient number of the SMS. Phone numbers should start with a "+" and country code (E.164 format), e.g. +6511111111.
msg - (optional) If provided, an estimate of the number of multipart SMS and total cost of sending this message will be included in the response
Returns:
Object containing all the responses from the server
Throws:
HoiioException

fetchSms

public Sms fetchSms(String txnRef)
             throws HoiioException
Fetches the current status of a SMS sent previously

Parameters:
txnRef - The unique reference ID for the required transaction.
Returns:
Object containing all the responses from the server
Throws:
HoiioException

send

public SmsTxn send(String dest,
                   String msg)
            throws HoiioException
Sends SMS to mobile numbers in over 200 countries

Parameters:
dest - The recipient number of the SMS. Phone numbers should start with a "+" and country code (E.164 format), e.g. +6511111111.
msg - Contents of the SMS message.
Returns:
Object containing all the responses from the server
Throws:
HoiioException

send

public SmsTxn send(String dest,
                   String msg,
                   String senderName,
                   String tag,
                   String notifyUrl)
            throws HoiioException
Sends SMS to mobile numbers in over 200 countries

Parameters:
dest - The recipient number of the SMS. Phone numbers should start with a "+" and country code (E.164 format), e.g. +6511111111.
msg - Contents of the SMS message.
senderName - (optional) This is the sender name that the recipient of your SMS will see.
tag - (optional) This is a text string containing your own reference ID for this transaction. This value will be included in the response for Notification, FetchSms and FetchHistory for your reference. Max 256 characters.
notifyUrl - (optional) A fully-qualified HTTP/S callback URL on your web server to be notified when the SMS has been delivered
Returns:
Object containing all the responses from the server
Throws:
HoiioException

sendBulk

public BulkSmsTxn sendBulk(List<String> dests,
                           String msg)
                    throws HoiioException
Sends SMS in bulk (up to 1000 messages) to any mobile numbers in more than 200 countries

Parameters:
dests - The list of recipient numbers of the SMS, separated by comma, up to a maximum of 1000 numbers. Phone numbers should start with a "+" and country code (E.164 format) e.g. +6511111111,+6522222222,+6533333333.
msg - Contents of the SMS message.
Returns:
Object containing all the responses from the server
Throws:
HoiioException

sendBulk

public BulkSmsTxn sendBulk(List<String> dests,
                           String msg,
                           String senderName,
                           String tag,
                           String notifyUrl)
                    throws HoiioException
Sends SMS in bulk (up to 1000 messages) to any mobile numbers in more than 200 countries

Parameters:
dests - The list of recipient numbers of the SMS, separated by comma, up to a maximum of 1000 numbers. Phone numbers should start with a "+" and country code (E.164 format) e.g. +6511111111,+6522222222,+6533333333.
msg - Contents of the SMS message.
senderName - (optional) This is the sender name that the recipient of your SMS will see
tag - (optional) This is a text string containing your own reference ID for this transaction. This value will be included in the response for Notification, FetchSms and FetchHistory for your reference. Max 256 characters.
notifyUrl - (optional) A fully-qualified HTTP/S callback URL on your web server to be notified when the SMS has been delivered
Returns:
Object containing all the responses from the server
Throws:
HoiioException

sendBulk

public BulkSmsTxn sendBulk(String dest,
                           String msg)
                    throws HoiioException
Sends SMS in bulk (up to 1000 messages) to any mobile numbers in more than 200 countries

Parameters:
dest - The list of recipient numbers of the SMS, separated by comma, up to a maximum of 1000 numbers. Phone numbers should start with a "+" and country code (E.164 format) e.g. +6511111111,+6522222222,+6533333333.
msg - Contents of the SMS message.
Returns:
Object containing all the responses from the server
Throws:
HoiioException

sendBulk

public BulkSmsTxn sendBulk(String dest,
                           String msg,
                           String senderName,
                           String tag,
                           String notifyUrl)
                    throws HoiioException
Sends SMS in bulk (up to 1000 messages) to any mobile numbers in more than 200 countries

Parameters:
dest - The list of recipient numbers of the SMS, separated by comma, up to a maximum of 1000 numbers. Phone numbers should start with a "+" and country code (E.164 format) e.g. +6511111111,+6522222222,+6533333333.
msg - Contents of the SMS message.
senderName - (optional) This is the sender name that the recipient of your SMS will see
tag - (optional) This is a text string containing your own reference ID for this transaction. This value will be included in the response for Notification, FetchSms and FetchHistory for your reference. Max 256 characters.
notifyUrl - (optional) A fully-qualified HTTP/S callback URL on your web server to be notified when the SMS has been delivered
Returns:
Object containing all the responses from the server
Throws:
HoiioException