This method is used to get the list of letters created both through the Selzy personal account and through the API (createEmailMessage + createCampaign methods etc.). To display the list of letters, you need to specify the time frame for the search and your API key. Additionally, you can specify the number of letters to display in one request, the position from which the list of letters will be displayed for this request, and the format for displaying data returned (json / html).
https://api.selzy.com/en/api/getMessages?api_key=KEY&date_from= yyyy-mm-dd hh:mm&date_to=yyyy-mm-dd hh:mm
Method obtains the following parameters:
- api_key* — API access key.
- date_from* — creation date bigger than, yyyy-mm-dd hh:mm UTC format.
- date_to* — creation date smaller than, yyyy-mm-dd hh:mm UTC format.
- format — display format obtains the values of html | json, json is set by default.
- limit — number of records in the response to one request, it must be an integer in the range from 1 to 100, 50 records are set by default.
- offset — start position of the selection, it must be 0 or more (the position of the first record starts from 0), 0 is set by default.
Return value
{ "result": [ { "id": 3769459, "sub_user_login": "", "list_id": 462767, "segment_id": null, "created": "2020-02-23 13:29:51", "updated": "2020-04-17 16:31:51", "service_type": "email", "active_version_id": null, "lang_code": "en", "sender_email": "[email protected]", "sender_name": "test", "subject": "test", "body": "<html></html>", "message_format":"raw_html" }, { "id": 3769462, "sub_user_login": "", "list_id": 462767, "segment_id": null, "created": "2016-03-25 14:25:51", "updated": "2016-05-18 16:31:33", "service_type": "sms", "active_version_id": null, "lang_code": "en", "sms_from": "Serg local", "body": "bnvbnbvnvbnvn" "message_format":"raw_html" }, ] }
where:
- id — identifier of the letter in the system.
- sub_user_login — either the login of the sub-user who created the letter or NULL if the letter was created by the master user.
- list_id — ID of the campaign list.
- 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).
- active_version_id — there will be null if active, or there will be an identifier of the active letter if there are versions and this version of the letter is not final.
- lang_code — two-letter language code to be automatically added to the letter with the unsubscribe form (for example, 'en', 'ru').
- body — body of the letter.
- message_format — returns the manner of creating a message: block — block editor, raw_html — html editor, text — text version of the letter.
- attachments — returns the files attached to the letter in the array, where:
— isInline — whether the attachment is inline (can obtain the value of true and false).
— name — attachment name.
— size — attachment size.
— url — the path to the attachment.
If there are no attachments to the letter, an empty «attachments» array is returned:
- sender_email (only if the message is an email) — the sender's email.
- sender_name (only if the message is an email) — the sender's name.
- subject (only if the message is an email) — subject of the letter.
- sender (only if the message is an sms) — the sender's name.
Errors format:
{ "error": "SZ150415-01 [ 'date_to' the value must be in the 'yyyy-mm-dd hh:mm' "2014-12-26 15:23:1"]" }