updateEmailMessage method

It is a method to edit an existing email message (without sending it). A new email message can be created using the createEmailMessage method.

Principle of use

Syntax and URL to call the method
updateEmailMessage (int id [,string sender_name, string sender_email,
string subject, string body, int list_id, string message_format, string lang,
string text_body, string raw_body, string categories])
api_key * API access key.
id * Identifier of the message to be edited that has been created earlier using the createEmailMessage method.
sender_name Sender's name. It is an optional string that does not match the email address (the sender_email argument).
sender_email Sender's email address. This email must be confirmed (to send a confirmation email, you can use the validateSender method, or create manually at least one email with this return address via the web interface, then click on the "send the confirmation request" link and follow the link from the email).
subject String with the letter subject. It may include substitution fields.
body Text of the letter in the HTML format with the possibility to add substitution fields. If you transfer the entire HTML text, test such letters additionally as headers outside the body may be modified. In addition, in order to reduce a difference in the display in various mail applications, we automatically add additional markup to each letter (a table with invisible borders, which also sets a default font and left alignment of the text). You may request to turn it off for your letters contacting our technical support service.
list_id Code of the list on which the mailing will be sent. Codes of all lists can be obtained by calling getLists. The letter may be sent only on a single list. You need to create a new letter to send on another list.
text_body Text version of the template.
message_format It defines the way of creating a letter: «block» — block editor, «raw_html» — html editor, «text» — text.

  • If you transfer the «text» value in this parameter, then if both the body and text_body parameters are filled in, the body parameter will be ignored and the template will be created based on the data transferred in the text_body parameter.
  • If you transfer the «block» value in this parameter but do not specify raw_body, the template will be saved as raw_html.
  • If you transfer the «block» value in this parameter, the body and raw_body parameters must be transferred for the message to be saved in the block editor format.
lang Two-letter language code for the string with the unsubscribe link that is added to each letter automatically.If it is not specified, the language code from the URL request to API is used.

In addition to the string with the unsubscribe link, this language also affects the interface of the unsubscribe page. Languages en, it, ua and ru are fully supported, and in case of some other languages (da, de, es, fr, nl, pl, pt, tr), the string with a link will be translated, and the control interface will be in English.

raw_body It is intended to save the json structure of the block editor data structure (if the value is message_format = block) The parameter obtains only the JSON structure, otherwise it will not be transferred.
categories Letter categories listed in the text form separated by commas.
Return value
JSON object with the single message_id field, which contains a unique message code – a positive 31-bit integer. It is used to send a message using the createCampaign method.
The message_id value may differ from the id due to creation of a new version of the letter. Example of the return value if request is successful:

    "result":{"message_id": 123456789},
    "warnings":[{"warning":"some warning text, if applicable"}]

Example of the returned value in the event of an error:

{"error":"error message", "code":"error code"}

Did we answer to your question?