Get Messages

Get messages from an existing stream.

A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value.

This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called.

GETyouragentURL.symphony.com/agent/v4/stream/{sid}/message
Path parameters
sid*string

Stream ID

Query parameters
Header parameters
Response

OK

Body
messageIdstring

Id of the message

parentMessageIdstring

Id of the parent message, set when the message is a reply to another message or a forwarded message. Since Agent 20.14.

timestampinteger (int64)

Timestamp of the message in milliseconds since Jan 1 1970

messagestring (MessageMLV2)

Message content in MessageMLV2

sharedMessageV4Message (object)

A representation of a message sent by a user of Symphony

datastring (JSON)

Message data in EntityJSON

attachmentsarray of V4AttachmentInfo (object)

Message attachments

userV4User (object)
streamV4Stream (object)
externalRecipientsboolean

Indicates if the message have external recipients. Only present on real time messaging.

diagnosticstring

Details if event failed to parse for any reason. The contents of this field may not be useful, depending on the nature of the error. Only present when error occurs.

userAgentstring

User agent string for client that sent the message. Allows callers to identify which client sent the origin message (e.g. API Agent, SFE Client, mobile, etc)

originalFormatstring

Indicates the format in which the message was originally sent. This could have been either:

  • com.symphony.markdown - Markdown OR Message ML V1
  • com.symphony.messageml.v2 - Message ML V2
disclaimerstring

Message that may be sent along with a regular message if configured for the POD, usually the first message sent in a room that day.

sidstring

Unique session identifier from where the message was created.

Example: "fa691cd3-484a-4109-aeb2-57c05b78c95b"
replacingstring

Id of the message that the current message is replacing (present only if set)

replacedBystring

Id of the message that the current message is being replaced with (present only if set)

initialTimestampinteger (int64)

Timestamp of when the initial message has been created in milliseconds since Jan 1 1970 (present only if set)

initialMessageIdstring

Id the the initial message that has been updated (present only if set)

silentboolean

When false the user/s will receive the message update as unread (true by default)

Request
const response = await fetch('youragentURL.symphony.com/agent/v4/stream/{sid}/message?since=0', {
    method: 'GET',
    headers: {
      "sessionToken": "text",
      "keyManagerToken": "text"
    },
});
const data = await response.json();
Response
[
  {
    "messageId": "text",
    "parentMessageId": "text",
    "timestamp": 0,
    "message": "text",
    "data": "text",
    "attachments": [
      {
        "id": "text",
        "name": "text",
        "size": 0,
        "images": [
          {
            "id": "text",
            "dimension": "text"
          }
        ]
      }
    ],
    "user": {
      "userId": 0,
      "firstName": "text",
      "lastName": "text",
      "displayName": "text",
      "email": "text",
      "username": "text"
    },
    "stream": {
      "streamId": "text",
      "streamType": "text",
      "roomName": "text",
      "members": [
        {
          "userId": 0,
          "firstName": "text",
          "lastName": "text",
          "displayName": "text",
          "email": "text",
          "username": "text"
        }
      ],
      "external": false,
      "crossPod": false
    },
    "externalRecipients": false,
    "diagnostic": "text",
    "userAgent": "text",
    "originalFormat": "text",
    "disclaimer": "text",
    "sid": "fa691cd3-484a-4109-aeb2-57c05b78c95b",
    "replacing": "text",
    "replacedBy": "text",
    "initialTimestamp": 0,
    "initialMessageId": "text",
    "silent": false
  }
]

📘 Optional attributes returned

Note that some attributes are returned in the payload only under specific conditions:

  • sharedMessage only when the message represented by this class is a wall post sharing another message;

  • initialMessageId, initialTimestamp, and replacing only when the corresponding message is sent as an update to another message thanks to Update Message endpoint. Note that the first two attributes relate to the original (and therefore first) message sent, whereas the replacing attribute relates to the message that has been updated by this message;

  • replacedBy only when this message has been updated by a new message. It contains the id of the replacing message.

  • parentMessageId only when this message is a reply or a forward of another message which id is returned in this attribute.

Pagination usage

• The skip parameter is supposed to be used to skip messages that have the same timestamp as the one specified on since.

• Pagination is supposed to use the since parameter instead of skip and limit.

Examples:

If you want to get two messages at a time skipping the ones you have already seen, the calls should be the following:

  1. First call https://acme.symphony.com/agent/v4/stream/sid/message?since=0&limit=2

  2. Second call Let's assume here that the timestamp from the message returned on the first call was 1551052800000 and there was no other message with that same timestamp returned.

https://acme.symphony.com/agent/v4/stream/sid/message?since=1551052800000&limit=2&skip=1

It returns the two messages received after or on the timestamp 1551052800000, skipping one message from that same timestamp (which is the one you have already seen).

Note that you can keep doing this process with subsequent calls.

📘 Supported stream types

In addition to conversation streams such as IM, MIM, Chat rooms and Wall posts, Symphony also supports other types of streams, some of them reserved for internal use. These other stream types (ACTION, POST, PRIVATE_CHANNEL, MEETING, SUPPRESS_JUSTIFICATION) are not supported by the Get Messages endpoint.

📘 See also:

Message MessageML Message ID Message Format - MessageML PresentationML Message Format - ExtensionML Colors

Last updated