« Back to Documentation Overview

add_draft

Section: Messages
Version: 1.5.0


Add a draft of given message type to the campaign. Useful for autosave features.
Conditions

  • campaign (mandatory) – CAMPAIGN_ID obtained from get_campaigns. Draft will be saved in this campaign.
  • from_field (optional) – FROM_FIELD_ID obtained from get_account_from_fields. It represents From header (name and email) in message and will be taken from campaign if not given.
  • reply_to_field (optional) – FROM_FIELD_ID obtained from get_account_from_fields. It represents Reply-To header (email) in message and will not be present if not given.
  • subject (mandatory) – Subject value. All merge-words should be written as GetResponse Dynamic Content syntax. Maximum length is 512 characters.
  • name (optional) – Name value to help distinguish messages. Contacts won't see it.
  • editor_engine (optional) - if set to "wysiwyg" will set newsletter to be edit in the new editor. If You want to edit message in advanced editor remove this parameter entirely
  • contents (mandatory) – Allowed keys are plain and html, at least one is mandatory. All merge-words should be written as GetResponse Dynamic Content syntax. Maximum length is 524288 characters each.
  • flags (optional) – Enables extra functionality for a message, see message_flags for available values.

Hint: Drafts can be obtained by using get_messages with type param.


Parameters
stringAPI_KEY
object
stringcampaignCAMPAIGN_ID
stringfrom_fieldFROM_FIELD_ID
stringreply_to_fieldFROM_FIELD_ID
stringsubjectMy draft
stringnameI will finish this later
stringeditor_enginewysiwyg
objectcontents
stringplainHello there
stringhtml<h1>Hello</h1>there
arrayflags
stringclicktrack
stringopenrate
Return Value
stringMESSAGE_IDabc123
integeradded1

Example Request JSON

[
    "API_KEY",
    {
        "campaign": "CAMPAIGN_ID",
        "from_field": "FROM_FIELD_ID",
        "reply_to_field": "FROM_FIELD_ID",
        "subject": "My draft",
        "name": "I will finish this later",
        "editor_engine": "wysiwyg",
        "contents": {
            "plain": "Hello there",
            "html": "<h1>Hello<\/h1>there"
        },
        "flags": [
            "clicktrack",
            "openrate"
        ]
    }
]

Example Response JSON

{
    "MESSAGE_ID": "abc123",
    "added": 1
}

Example Error Response JSON

{
    "code": -1,
    "message": "Missing contents"
}
Method-specific Errors
Missing campaign
Missing from-field
Missing reply-to field
Missing contents
API-wide Errors
API key verification failed API key verification failed
API client IP not allowed API client IP not allowed
Invalid params Attribute params must be reference to hash