editMessage

Edits a Message.

Top ↑

Syntax

int editMessage( string api_key, array message_details );

Parameters

api_key (string)

The key required to access the API. See Getting Started for more information.

message_details (array)

An associative array of Message details to be edited. See remarks below for a description of the values in the message_details array.

Return Value

Returns the ID of the edited Message on success.

Examples

The example code changes the subject of Message 111222 to An Important Message from your Bank.

$message_details = array(
    'id' => 111222,
    'subject' => 'An Important Message from your Bank',
);

$api = new Api($url, 'YOURAPIKEY');
$message_id = $api->invokeMethod('editMessage', $message_details);
{
    "id": 4,
    "method": "editMessage",
    "params": [
        "YOURAPIKEY",
        {
            "id": 111222,
            "subject": "An Important Message from your Bank"
        }
    ]
}
{
    "id": 4,
    "result": 111222,
    "error": null
}

Remarks

The following table shows the structure of the message_details array.

Key Type Mandatory Description
id int Yes ID of the Message.
name string No The name of the Message.
subject string No The Email subject for email Messages.
html_content string No The HTML content for html, plain-html and raw_html Emails.
text_content string No The text content for plain and plain-html Emails.
sms_content string No The content for sms Messages.
from_address string No For email Messages, a valid Email address or an Email wildcard (variable). For sms Messages, a valid mobile phone number or a phone number wildcard.
from_name string No The name of the sender for email Messages.
reply_to string No An Email address or Email wildcard (variable.) Only used for email Messages.
postal_address string No The postal address of the sender for email Messages.
authorised_sender string No The authorised sender of the Email for email Messages.
show_update_profile_link bool No Whether or not to show an update profile link for email Messages.
show_unsubscribe_link bool No Whether or not to show an unsubscribe link for email Messages.
unsubscribe_list_id int No The ID of the List accessed by unsubscribe links for email Messages.
unsubscribe_webform_id int No The ID of the web form accessed by unsubscribe links for email Messages. Ignored if invalid or unsubscribe_list_id is set.
update_profile_list_id int No The ID of the List accessed by update profile links for email Messages.
update_profile_webform_id int No The ID of the web form accessed by update profile links for email Messages. Ignored if invalid or update_profile_list_id is set.
folder_id int No The ID of the Folder to contain the Message.

The method cannot change the type of an existing Message.

Error Codes

This method may return the following error codes in addition to the standard error codes:

Code Error Description
302 Undefined Method Error The system could not save the changes.
307 Unable to Load Message Message ID is invalid or system cannot edit the Message.
317 Invalid Email Address Specified: from_address from_address value is invalid.
326 SMS content too large sms_content value exceeds 600 characters.
310 Invalid unsubscribe_list_id unsubscribe_list_id value is invalid.
310 Invalid unsubscribe_webform_id unsubscribe_webform_id value is invalid.
310 Invalid update_profile_list_id update_profile_list_id value is invalid.
310 Invalid update_profile_webform_id update_profile_webform_id value is invalid.

See Also