This method is used to get the list of messages created both through the Selzy 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.selzy.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: | |
format | The 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). |
limit | Number 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. |
offset | The 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": "en", "created": "2020-02-23 13:29:51", "updated": "2020-04-17 16:31:51", "service_type": "email", "message_format": "block", "sender_email": "[email protected]", "sender_name": "User", "subject": "5" }, {}, {} ] } |
Where:
id — identifier of the template in the system.
login — login in the Selzy 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.
created — message creation date and time, UTC.
updated - message updation date and time, UTC.
service_type — message type (email or sms).
message_format — returns the manner of creating a template: «block» — block editor, «raw_html» — html editor.
lang_code — two-letter language code to be automatically added to the letter with the unsubscribe form (for example,'en', 'ru').
sender_email — sender's email address.
sender_name — sender's name.
subject — template subject.