« Back to Documentation Overviewadd_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
|
---|
string | API_KEY |
object | string | campaign | CAMPAIGN_ID | string | from_field | FROM_FIELD_ID | string | reply_to_field | FROM_FIELD_ID | string | subject | My draft | string | name | I will finish this later | string | editor_engine | wysiwyg | object | contents | string | plain | Hello there | string | html | <h1>Hello</h1>there |
| array | flags | string | clicktrack | string | openrate |
|
|
Return Value
|
---|
string | MESSAGE_ID | abc123 |
integer | added | 1 |
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 |