6.8.2 Send

Send is used to send an SMS or MMS message. It takes a set of input parameters that specifies the message type, and the message details associated with that particular message type.

The following are the examples for using Send:

Synchronous

messaging_handle.call('Send', {'MessageType': u'SMS', 'To': u'12345678',
                               'BodyText': u'Hi'})

Asynchronous

messaging_handle.call('Send', {'MessageType': u'SMS', 'To': u'12345678', 'BodyText': u'Hi'},
                      callback=callback_function)

where, callback_function is a user defined callback function.

The following table summarizes the specification of Send:

Interface IMessaging
Description Sends the message.
Response Model Synchronous and asynchronous
Pre-condition Valid instance of IMessaging interface is instantiated.
Post-condition Nil

Input Parameters

Input parameter specifies the type of messaging object and its details.

Table 6.166: Input parameters for Send
Name Type Range Description
MessageType unicode string SMS
MMS
This specifies the message type.
To unicode string NA Multiple recipients can be passed using MessageParam.
[BodyText] unicode string NA Body text for the message.
[Subject] unicode string NA Message subject. Not applicable for SMS.
[Attachment] unicode string FileName with complete path. Attachment Name (Full path). Valid for MMS only. Additional attachments can be passed using MessageParam.
[MimeType] unicode string NA Mime type of the attachment mentioned above.
[MessageParam] map
[To]: List (unicode string)
[Cc]: List (unicode string)
[Bcc]: List (unicode string)
[AttachmentList]: List (map)
[TemplateId]: 32 bit int
[LaunchEditor]: bool

AttachmentList map elements contains:
FileName: unicode string
[MimeType]: unicode string

FileName: FileName with complete path.

MimeType example: image/gif, image/jpeg and so on.
MimeType is searched in system for the given file name. It is used if found or, user provided MimeType is taken.

This parameter specifies the full details of the message depending on its type. It adds the body text as text attachment in case of MMS. Template Id is the message id, which is the template for new message. Bcc is supported for email only. (Currently email is not supported in the service)

In case of template id, if the body text of message is specified and exists for the given template Id then both the body text specified will be appended to the template Id message body text and sent.

If Launch Editor Flag is set to ETrue then, the Message Editor will be popped up over the application expecting you to act, by default it is EFalse.


Output Parameters

Output parameters contain ErrorCode, and ErrorMessage if the operation fails.

Table 6.167: Output parameters for Send
Name Type Range (Type: string) Description
ErrorCode int NA Service specific error code on failure of the operation.
ErrorMessage string NA Error description in Engineering English.


Errors

The following table lists the error codes and their values:

Table 6.168: Error codes
Error code value Description
0 Success
1000 Invalid service argument
1002 Bad argument type
1003 Missing argument
1004 Service not supported
1007 No memory
1012 Item Not found


Error Messages

The following table lists the error messages and their description:


Table 6.169: Error messages
Error messages Description
Messaging:Send:MessageType Type Invalid Specifies if the type of MessageType parameter is invalid.
Messaging:Send:MessageType Value Incorrect Specifies if the value of MessageType parameter is incorrect.
Messaging:Send:MessageType Missing Specifies if the MessageType parameter is missing.
Messaging:Send:To Type Invalid Specifies if the type of To parameter is invalid.
Messaging:Send:To Value Incorrect Specifies if the value of To parameter is incorrect.
Messaging:Send:To Missing Specifies if the To parameter is missing.
Messaging:Send:BodyText Type Invalid Specifies if the type of BodyText parameter is invalid.
Messaging:Send:Subject Type Invalid Specifies if the type of Subject parameter is invalid.
Messaging:Send:Attachment Type Invalid Specifies if the type of Attachment parameter is invalid.
Messaging:Send:Attachment Value Incorrect Specifies if the value of Attachment parameter is incorrect.
Messaging:Send:MimeType Type Invalid Specifies if the type of MimeType parameter is invalid.
Messaging:Send:MimeType Value Incorrect Specifies if the value of MimeType parameter is incorrect.
Messaging:Send:MessageParam Type Invalid Specifies if the type of MessageParam parameter is invalid.
Messaging:Send:TemplateId Type Invalid Specifies if the type of TemplateId parameter is invalid.
Messaging:Send:LaunchEditor Type Invalid Specifies if the type of LaunchEditor parameter is invalid.
Messaging:Send:To Type Invalid Specifies if the type of To parameter is invalid.
Messaging:Send:To List Element Type Invalid Specifies if the type of element of To List parameter is invalid.
Messaging:Send:To List Element Value Incorrect Specifies if the value of element of To List parameter is incorrect.
Messaging:Send:Cc Type Invalid Specifies if the type of Cc parameter is invalid.
Messaging:Send:Cc List Element Type Invalid Specifies if the type of element of Cc List parameter is invalid.
Messaging:Send:Cc List Element Value Incorrect Specifies if the value of element of Cc List parameter is incorrect.
Messaging:Send:Bcc Type Invalid Specifies if the type of Bcc parameter is invalid.
Messaging:Send:Bcc List Element Type Invalid Specifies if the type of element of Bcc List parameter is invalid.
Messaging:Send:Bcc List Element Value Incorrect Specifies if the value of element of Bcc List parameter is incorrect.
Messaging:Send:AttachmentList Type Invalid Specifies if the type of AttachmentList parameter is invalid.
Messaging:Send:AttachmentList Element Type Invalid Specifies if the type of element of AttachmentList parameter is invalid.
Messaging:Send:FileName Type Invalid Specifies if the type of FileName parameter is invalid.
Messaging:Send:FileName Value Incorrect Specifies if the value FileName parameter is incorrect.
Messaging:Send:MimeType Type Invalid Specifies if the type of MimeType parameter is invalid.
Messaging:Send:MimeType Value Incorrect Specifies if the value MimeType parameter is incorrect.


Example

The following sample code illustrates how to send SMS message to the specified phone number:

import scriptext

messaging_handle = scriptext.load('Service.Messaging', 'IMessaging')

try:
    messaging_handle.call('Send', {'MessageType': u'SMS', 'To': u'12345678',
                                   'BodyText': u'Hi'})
except scriptext.ScriptextError, err:
    print "Error sending SMS : ", err
else:
    print "SMS sent successfully"

See About this document... for information on suggesting changes.