« Back to Documentation Overview

get_messages

Section: Messages
Version: 1.5.0


Get messages in account.
Conditions:

  • campaigns / get_campaigns (optional) – Search only in given campaigns. Uses OR logic. If those params are not given search, is performed in all campaigns in the account. Check IDs in conditions for detailed explanation.
  • type (optional) – Use "newsletter", "autoresponder", "ab_test" or "draft" to narrow down search results to specific message types. If not given newsletters and autoresponders are returned in the result.
  • subject (optional) – Use text operators to narrow down search results to specific message subjects.
  • name (optional) – Use text operators to narrow down search results to specific message names.
  • send_on (optional) – Use time operators to narrow down search results to specific sending date. Multiple operators are allowed and logic AND is used so date range can also be expressed. Works only for newsletters because other message types do not have fixed sending point in time. If message was sent with Time Travel then it may appear in search results for two different days as sending period equals 24 hours.
  • created_on (optional) – Use time operators to narrow down search results to specific message creation date. Multiple operators are allowed and logic AND is used so date range can also be expressed.

Returned data
Array flags may be present with following items:
  • clicktrack – Clicks on links in message are counted. Note that for the link to be click-tracked it must be also wrapped in GetResponse Dynamic Content {{LINK}} tag. This behaves differently than web interface, where (for simplicity) all links are click-tracked when click-track checkbox is set.
  • subscription_reminder – Short disclaimer is added to the message content to make sure that subscriber know why they are receiving the messages.
  • openrate – Opened messages are counted (only if html content is present).
  • google_analytics – Google Analytics code is appended to every link in message.
Hint: All merge-words in subject are returned as GetResponse Dynamic Content syntax.
Hint: Additional fields:
  • When type is "newsletter" then send_on is also returned.
  • When type is "ab_test" then ab_test is also returned, more information about it can be obtained from get_ab_test method
  • When type is "autoresponder" then status ("active"/"inactive"), based_on ("time"/"action"), time_travel ("yes"/"no") and days_of_week are also returned. Optional at_hour and delay_hours may also be returned and they are mutually exclusive.
  • When type is "autoresponder" and based_on is "time" then day_of_cycle is also returned.
  • When type is "autoresponder" and based_on is "action" then action object is also returned. It always contains event and more fields that depends on its value: "contact_subscribed" = day_of_cycle, "mail_opened" = message + recurrent, "link_clicked" = link + recurrent, "goal_reached" = goal + recurrent, "custom_changed" = custom + value (optional) + recurrent, "autoresponder_action_happened" = recurrent, "birthday" = custom.
Hint: If you need plain and HTML contents of your message use get_message_contents method.


Parameters
stringAPI_KEY
object
arraycampaigns
stringCAMPAIGN_ID
stringCAMPAIGN_ID
objectget_campaigns
stringCONTAINSmy_campaign_%
stringtypevalue
objectsubject
stringOPERATORvalue
objectname
stringOPERATORvalue
objectsend_on
stringOPERATORvalue
objectcreated_on
stringOPERATORvalue
Return Value
objectMESSAGE_ID
stringcampaignCAMPAIGN_ID
stringtypenewsletter
stringsubjectMy newsletter
stringnameget_messages_name__string
arrayflags
stringsend_on2010-01-01 00:00:00
arraycontent_types
stringplain
stringcreated_on2010-01-01 00:00:00

Example Request JSON

[
    "API_KEY",
    {
        "campaigns": [
            "CAMPAIGN_ID",
            "CAMPAIGN_ID"
        ],
        "get_campaigns": {
            "CONTAINS": "my_campaign_%"
        },
        "type": "value",
        "subject": {
            "OPERATOR": "value"
        },
        "name": {
            "OPERATOR": "value"
        },
        "send_on": {
            "OPERATOR": "value"
        },
        "created_on": {
            "OPERATOR": "value"
        }
    }
]

Example Response JSON

{
    "MESSAGE_ID": {
        "campaign": "CAMPAIGN_ID",
        "type": "newsletter",
        "subject": "My newsletter",
        "name": null,
        "flags": [],
        "send_on": "2010-01-01 00:00:00",
        "content_types": [
            "plain"
        ],
        "created_on": "2010-01-01 00:00:00"
    }
}
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