Click or drag to resize
ZenophSMSgetMessagePreview Method
Gets a preview of the message that will be sent to a destination.

Namespace: Zenoph.SMSLib
Assembly: Zenoph.SMSLib (in Zenoph.SMSLib.dll) Version: 2015.9.30.0 (2015.09.30.0)
Syntax
public string getMessagePreview(
	string phonenum
)

Parameters

phonenum
Type: SystemString
The destination that the message will be sent to.

Return Value

Type: String
Returns a preview of the message that will be sent to a destination.
Exceptions
ExceptionCondition
Exception Thrown if phonenum is not a valid phone number or does not exist in the destinations list.
Remarks

The method gets a preview of the message that will be sent to a destination. This is particularly useful for personalised messaging. For personalised messaging, the message parameter that is set contains variables that define the parts of the message that will be different for each destination. This method gets a preview of the message that will be sent to a particular destination after values have been substituted in place of the variables defined in the message.

For non-personalised messages, the method returns the same message as set with the setMessage(String) method and all destinations will receive the same message.

Examples
// Initialise SMS object
ZenophSMS sms = new ZenophSMS();
sms.setUser("account_login");
sms.setPassword("account_password");
sms.authenticate();

// set message parameters.
sms.setMessage("Hello {$name}, your account balance is ${$balance}.");
sms.setMessageType(MSGTYPE.TEXT);
sms.setSenderId("SMSTEST");

// add destinations.
string[] dests = new string[] {"0239342867", "0507999109", "0287934907"};
sms.addRecipient(dests[0], new string[] {"Daniel", "5,345.45"}, true);
sms.addRecipient(dests[1], new string[] {"Oppong", "468.34"}, true);

// this is just a variation.
string[] values = new string[] {"Dennis", "854.65"};
sms.addRecipient(dests[2], values);

// let's get a preview of a destination.
string preview = sms.getMessagePreview(dests[1]);
Console.WriteLine("Message preview for {0}:  {1}", dests[1], preview);
See Also