Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages

listMessages method

This method is used to get the list of messages created both through the UniSender personal account and through the API. The method works like getMessages, the difference of listMessages is that the letter body and attachments are not returned, while the user login is returned. To get the body and attachments, use the getMessage method.

To display the list of templates, you need to specify the time frame for the search and your API key. Additionally, you can specify the number of templates to display in one request, the position from which the list of templates will be displayed for this request, and the format for returned data displaying (json / html).

Principle of use

Syntax and URL to call the method
listMessages ([datetime date_from, datetime date_to], string format, int limit, int offset)
https://api.unisender.com/en/api/listMessages?format=json&api_key=KEY
Arguments
api_key *API access key.
date_from *Message creation date and time, from which messages are to be displayed, in the «YYYY-MM-DD hh:mm:ss» format, time zone UTC.
date_to *Message creation date and time, until which messages are to be displayed, in the «YYYY-MM-DD hh:mm:ss» format, time zone UTC.
Additional parameters:
formatThe display format obtains values of html | json, json is set by default (the html format is intended only for visual viewing of the result, the parser will not work in this format).
limitNumber of records in the response to one request must be an integer in the range from 1 to 100, 50 records are set by default.
offsetThe parameter indicates from which position the selection is to be started. The value must be 0 or more (the position of the first record starts from 0), 0 is set by default.
Return value
JSON array, each array element is an object with the following fields. Description of fields is under the example.
Example of the return value:

{
 "result": [
 {
 "id": 422231232,
 "login": "ALogin",
 "sub_user_login": "",
 "list_id": 1234567,
 "segment_id": null,
 "lang_code": "ru",
 "service_type": "email",
 "message_format": "block",
 "sender_email": "test.test@gmail.com",
 "sender_name": "User",
 "subject": "5"
 },
 {},
 {}
 ]
}

Where:

id — identifier of the template in the system.
login — login in the UniSender system.
sub_user_login — either the login of the sub-user who created the template or NULL if the letter was created by the master user.
list_id — identifier of the contacts list to which this template was attached in the process of creation.
segment_id — filter identifier if the letter is created by a segment.
service_type — message type (email or sms).
lang_code — two-letter language code to be automatically added to the letter with the unsubscribe form (for example, ‘ru’, ‘en’).
sender_email — sender’s email address.
sender_name — sender’s name.
subject — template subject.
message_format — returns the manner of creating a template: «block» — block editor, «raw_html» — html editor.