Click or drag to resize
ZenophSMSaddRecipient Method (String, String)
Adds a phone number and its personalised values to the destinations list. If the phone number already exists, the values specified for this method call will replace the already existing values.

Namespace: Zenoph.SMSLib
Assembly: Zenoph.SMSLib (in Zenoph.SMSLib.dll) Version: 2015.9.30.0 (2015.09.30.0)
Syntax
public bool addRecipient(
	string phonenum,
	string[] values
)

Parameters

phonenum
Type: SystemString
The phone number to be added to the destinations list.
values
Type: SystemString
The personalised values for the destination.

Return Value

Type: Boolean
Returns true if the phone number is added to the destinations list, otherwise it returns false.
Exceptions
ExceptionCondition
Exception Thrown if phonenum is invalid, not allowed on user routes, or when values is null or invalid.
Remarks

The method adds a phone number and its personalised values to the destinations list. When adding personalised values for destination, the message must already be set and contain variables. The total number of values must be equal to the number of variables defined in the set message. Additionally, the values must be ordered to match each variable defined in the message.

This method will throw Exception if either the phone number is not added or when the personalised values for the destination are invalid. If the throwing of Exception needs to be ignored, especially in an iteration, the overloaded method addRecipient(String, String, Boolean) must be called instead passing true as the first argument.

For a complete example on adding personalised values for destinations and submission, see the discussion on addRecipient(String, String, Boolean).

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

// set the message with variables for personalisation.
sms.setMessage("Hello {$name}, meet me at the {$location}.");

// add phone numbers and personalised values.
sms.addRecipient("233207777777", "Daniel", "zoo");
sms.addRecipient("233246111111", "Oppong", "hospital");

Each value must have a matching variable in the message as demonstrated above. The values will be substituted in the message for submission to each destination.

See Also