Skip to main content

Requesting Message History

Last updated: 8 April 2025

The api/messages/history method is used to request the recipient’s message history.

Calling api/messages/history Method

To call the api/messages/history method, send a POST request to the URL https://app.edna.io/api/messages/history.

If the request is successful, the method returns a response with a code of 200 and a JSON object with text and information about the message. If the request fails, the method returns an error code. More (#errors).

Request Body Format

{
"subscriberFilter": {
"address": "35000000000",
"type": "PHONE"
},
"offset": 0,
"limit": 0,
"channelTypes": [
"SMS"
],
"messageId": 567890,
"direction": "OUT",
"dateFrom": "2024-07-01T00:00:00Z",
"dateTo": "2024-07-22T00:00:00Z",
"sort": [
{
"property": "messageId",
"direction": "DESC"
}
],
"trafficTypes": [
"AD"
],
"subjectId": 0
}

Request Example

POST https://app.edna.io/api/messages/history 
x-api-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Content-Type: application/json

Request body with the subscriberFilter parameter

{
"subscriberFilter": {
"address": "35000000000",
"type": "PHONE"
},
"offset": 0,
"limit": 1000,
"channelTypes": [
"SMS"
],
"messageId": 567891,
"direction": "OUT",
"dateFrom": "2024-07-01T00:00:00Z",
"dateTo": "2024-07-22T00:00:00Z",
"sort": [
{
"property": "messageId",
"direction": "DESC"
}
],
"trafficTypes": [
"AD"
],
"subjectId": 50192
}

Request body without the subscriberFilter parameter

{
"offset": 0,
"limit": 1000,
"channelTypes": [
"SMS"
],
"direction": "OUT",
"dateFrom": "2024-07-01T00:00:00Z",
"dateTo": "2024-07-22T00:00:00Z",
"sort": [
{
"property": "messageId",
"direction": "DESC"
}
],
"trafficTypes": [
"AD"
],
"subjectId": 50192
}

Request Parameters

ParameterData typeCharacterDescription
subscriberFilterobjectOptionalRecipient filter.
subscriberFilter.addressstringOptionalRecipient's address. For example, a phone number.
subscriberFilter.typestringOptionalRecipient address type:

- PHONE.

- EMAIL

- UTM

- COOKIE_ID

- INSTAGRAM_ID

- TELEGRAM_ID

- GOOGLE_ID

- APPLE_ID

- YANDEX_ID

- EXT_USER_ID

- FACEBOOK_ID

- EXT_USER_ID

offsetintegerOptionalThe number of messages to skip after sorting.

The default value is 0.
limitintegerOptionalThe number of messages in the response.

The default value is 0, and the maximum value is 1000.
channelTypesarray of stringsOptionalChannel type:

- WHATSAPP — WhatsApp channel;

- VIBER — Viber channel.

You can pass multiple values.
directionstringRequired if the messageId parameter is usedThe direction of the message.

- IN — from the recipient;

- OUT— to the recipient.
DateFromstringOptionalThe date in the ISO 8601 format (for example, 2024-07-01T00:00:00Z) from which the messages are requested. By default, messages for the last 30 days are requested.

To receive all messages from a certain date in the past to the present, specify the required date only in the DateFrom parameter and leave the DateTo parameter empty.

If necessary, specify the number of messages you want to receive in the limit parameter.

ISO 8601 - Convention
dateTostringOptionalThe date in the ISO 8601 format (for example, 2024-07-01T00:00:00Z) from which the messages are requested. By default, messages for the last 30 days are requested.

The maximum range of values between the DateFrom and DateTo parameters is 366 days.

To get all messages for the last 30 days, specify the date in the last 30 days in the DateTo parameter and leave the DateFrom parameter empty. If you specify a date later than 30 days ago in the DateTo parameter and leave the DateFrom parameter empty, the response will contain an empty list.

If necessary, specify the number of messages you want to receive in the limit parameter.

ISO 8601 - Convention
sortobjectOptionalSorting options.
sort.propertystringOptionalValue of the parameter for sorting. You can use the value of any parameter from the sample response.
sort.directionstringOptionalSorting direction:

- ASC — ascending sort;

-DESC — descending sort (default)

Is used only with the sort.property parameter.
trafficTypesarray of stringsOptionalTraffic type with the value of the direction:OUT parameter:

- AD — advertising messages;

- SERVICE — service messages;

- HSM — WhatsApp template messages;

- CHAT — WhatsApp messages in free form.
SubjectIDintegerOptionalSignature identifier.
messageIdinteger (long)OptionalInternal message identifier.

Response Format

In response to the request, a JSON object is returned with messages sent to or received from the user according to the specified conditions.

Response Example

{
"content": [
{
"messageId": 8270556,
"tenantId": 3193,
"channelType": "SMS",
"direction": "OUT",
"address": "35000000000",
"content": "{\"text\": \"Hello. Glad to see\", \"type\": \"TEXT\"}",
"deliveryStatus": "DELIVERED",
"deliveryStatusAt": "2024-07-23T08:08:20.000+0000",
"sentOrReceivedAt": "2024-07-23T08:08:20.201+0000",
"subjectId": 50192,
"subjectName": "subject_sms",
"cascadeId": 32522,
"cascadeName": "cascade_sms",
"cascadeStageUuid": "b75c5b32-d185-4784-aac0-ec3adc468a71",
"broadcastId": 318463,
"broadcastName": "cxzxzcxzcxz",
"trafficType": "AD",
"segments": 1,
"subscriberId": 11354769
},
{
"messageId": 8270515,
"tenantId": 3193,
"channelType": "SMS",
"direction": "OUT",
"address": "35000000000",
"content": "{\"text\": \"Hello. Glad to see\", \"type\": \"TEXT\"}",
"deliveryStatus": "DELIVERED",
"deliveryStatusAt": "2024-07-23T08:02:11.000+0000",
"sentOrReceivedAt": "2024-07-23T08:02:11.223+0000",
"subjectId": 50192,
"subjectName": "subject_sms",
"cascadeId": 32522,
"cascadeName": "cascade_sms",
"matcherId": 6199,
"matcherName": "serv_1",
"cascadeStageUuid": "b75c5b32-d185-4784-aac0-ec3adc468a71",
"broadcastId": 318462,
"broadcastName": "cxvzxc",
"trafficType": "SERVICE",
"segments": 1,
"subscriberId": 11354769
}
],
"hasNext": false
}

Response parameters

ParameterData typeDescription
contentarray of objectsArray of transmitted messages.
content.messageIdintegerInternal ID of the message.
content.TenantIdintegerID of the user's personal account.
content.channelTypestringChannel type
content.directionstringMessage direction.

- IN — from the recipient;

- OUT — to the recipient.

By default, all messages are returned.
content.addressstringSender's address for incoming and recipient's address for outgoing messages.
content.contentstringText of the message.

When using WhatsApp Flows, information about Flow will be sent in this parameter:

- for outgoing messages — information about Flow;

- for incoming messages — information about the recipient's responses in Flow.
content.deliveryStatusstringMessage delivery status.

- ACCEPTED — the message was received by edna Pulse;

- INVALID — the outgoing message did not pass the validation stages on the edna Pulse side;

- ENQUEUED — the outgoing message was successfully sent on the edna side Pulse;

- SENT — outgoing message successfully sent to recipient;

- UNDELIVERED — outgoing message not delivered to recipient or unsuccessfully sent;

- DELIVERED — outgoing message delivered to recipient;

- READ — the outgoing message has been read by the recipient.
`content.deliveryStatusAt'stringDate and time of delivery status in ISO 8601 format (for example, 2024-01-11T01:01:11.000+0000)

https://sentenz .github.io/convention/convention/iso-8601/
content.deliveryStatusMessagestringDelivery status message.
content.sentOrReceivedAtstringDate and time of sending outgoing messages and delivering incoming messages in ISO 8601 format (for example, 2024-01-11T02:02:22.223+0000).

ISO 8601 - Convention
content.subjectIdintegerThe signature ID.
content.subjectNamestringSignature name.
content.cascadeIdintegerCascade ID.
content.cascadeNamestringCascade name.
content.cascadeStageUuidstringCascade step number.
content.broadcastIdintegerThe broadcast list ID.
content.broadcastNamestringMailing list name.
content.trafficTypearray of stringsTraffic type with the value of the direction:OUT parameter:

- AD — advertising messages;

- SERVICE — service messages;

- HSM — WhatsApp template messages;

- CHAT — WhatsApp messages in free form.
content.segmentsintegerThe number of message segments.
content.subscriberIdintegerThe recipient's ID in edna Pulse.
content.matcherIdintegerID of the template that messages were sent to when the direction:OUT parameter was set.
content.matcherNamestringThe name of the template used to send messages with the value of the direction:OUT parameter.
content.commentstringComment on the message.

The comment parameter can be passed when sending messages and used to uniquely identify messages or newsletters.
hasNextbooleanThe flag for the presence of the next page.
content.replyInMessageIdintegerThe internal identifier of the user's quoted message. The user quotes his message sent to the company.
content.replyOutMessageIdintegerThe internal identifier of the quoted message of the company. The user quotes a message received from the company.
ExternalRequestIdintegerThe external identifier of the company's quoted message, which it specifies when sending an outgoing message via the API. In the event that the user quoted a message received from the company.

Errors

Possible errors after calling the api/messages/history method:

CodeErrorDescription
401Api key not foundInvalid API key specified.
400not-valid-requestAn empty value of the address parameter is specified.
400limit-not-validA value greater than 1000 is specified in the limit parameter.
400date-range-not-validThe range of values between the DateFrom and DateTo parameters exceeds 366 days.
400message-matcher-subject-not-foundInvalid identifier is specified in the value of the SubjectID parameter.