public class Message
extends java.lang.Object
Constructor and Description |
---|
Message(java.lang.String key,
java.lang.String secret,
RecipientType recipientType,
int templateId)
Constructor Takes key and secret which are provided in the settings page of your account
|
Message(java.lang.String key,
java.lang.String secret,
RecipientType recipientType,
java.lang.String messageContent)
Constructor Takes key and secret which are provided in the settings page of your account
|
Message(java.lang.String key,
java.lang.String secret,
java.lang.String recipientType)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Message |
addRecipient(java.lang.String recipient)
For adding a new recipient to the list of recipients to receive messages.
|
Message |
addRecipientList(java.util.List<java.lang.String> to)
For adding a list of recipients to receive the message to be sent
|
int |
getEncoding()
Returns the value of the encoding set.
|
java.time.LocalDate |
getExpiry()
Returns the expiry date for when the message is to be deemed useless if not received by the recipient.
|
java.lang.String |
getFrom()
Returns the from address to be used in the message.
|
java.lang.String |
getKey() |
java.lang.String |
getMessage()
Returns the message content to be sent.
|
int |
getReceipt()
Returns the value indicating whether a receipt is required or not.
|
RecipientType |
getRecipientType()
Returns the indicator for what type of recipients are in the recipients list, whether it is a group or individual recipients
|
java.time.LocalDate |
getSchedule()
Returns the schedule date for when the message is to be sent.
|
java.lang.String |
getSecret() |
int |
getTemplateId() |
java.util.List<java.lang.String> |
getTo()
Returns the recipient list, or group list depending on what was put in.
|
Message |
setEncoding(int encoding)
- Optional - Sets the character encoding to go along with the message.
|
Message |
setExpiryDate(java.lang.String expiryDate)
setExpiryDate - Optional - Sets the date the system will stop trying to deliver the message if that recipient is not available to receive the message at that time.
|
Message |
setFrom(java.lang.String from)
Set the "from" address/number.
|
Message |
setMessage(java.lang.String messageContent)
Deprecated.
|
Message |
setReceiptOption(int receiptIndicator)
setReceiptOption - Optional - Sets whether a receipt is relayed to the provided callback url or not.
|
Message |
setRecipientType(java.lang.String type)
Sets the type of recipient, as user can send to a list of numbers, or a to list of groups on their account
|
Message |
setSendDate(java.lang.String sendDate)
setSendDate - Optional - Sets date and time to send message.
|
public Message(java.lang.String key, java.lang.String secret, java.lang.String recipientType) throws MessageException, RecipientTypeException
key
- SMSJuice account keysecret
- SMSJuice account secretMessageException
RecipientTypeException
public Message(java.lang.String key, java.lang.String secret, RecipientType recipientType, java.lang.String messageContent) throws MessageException
key
- SMSJuice account keysecret
- SMSJuice account secretrecipientType
- Type of recipients to send to. On your SMSjuice account you have groups of numbers, and individual numbers. This distinguishes whether you are sending to groups or individual numbersmessageContent
- The actual content of the message that will be read by the recipient(s)MessageException
public Message(java.lang.String key, java.lang.String secret, RecipientType recipientType, int templateId) throws MessageException
key
- SMSJuice account keysecret
- SMSJuice account secretrecipientType
- Type of recipients to send to. On your SMSjuice account you have groups of numbers, and individual numbers. This distinguishes whether you are sending to groups or individual numberstemplateId
- the ID of the template stored on your SMSJuice account that you wish to use as message contentMessageException
public Message setFrom(java.lang.String from) throws MessageException
from
- The "from" address/numberMessageException
public Message addRecipient(java.lang.String recipient) throws ContactException
recipient
- mobile phone to receive the messageMessageException
ContactException
public Message addRecipientList(java.util.List<java.lang.String> to)
to
- List of recipient phone numbers OR group namespublic Message setRecipientType(java.lang.String type) throws RecipientTypeException
type
- Recipient type determining whether the recipient list is made of numbers or group namesRecipientTypeException
public Message setMessage(java.lang.String messageContent) throws MessageException
messageContent
- message content to sendMessageException
public Message setReceiptOption(int receiptIndicator) throws MessageException
receiptIndicator
- indicator for whether a receipt is needed or notMessageException
public Message setSendDate(java.lang.String sendDate) throws MessageException
sendDate
- date and time to send the messageMessageException
public Message setExpiryDate(java.lang.String expiryDate) throws MessageException
expiryDate
- MessageException
public java.lang.String getKey()
public java.lang.String getSecret()
public int getReceipt()
public int getEncoding()
public Message setEncoding(int encoding) throws MessageException
encoding
- The encoding caluse to use. Recommendation is to use 0, 3 or 8 as values as they are
the most commonly used. The default is 0 if one doesn't select which one they want to use, and it usually suffices.MessageException
- triggered when one tries to instantiate the object with a value less than 0 or grater than 8 .public java.lang.String getFrom()
public java.lang.String getMessage()
public java.time.LocalDate getSchedule()
public java.time.LocalDate getExpiry()
public java.util.List<java.lang.String> getTo()
public RecipientType getRecipientType()
public int getTemplateId()