## List sequence messages

`client.Sequence.ListMessages(ctx, id, query) (*SequenceListMessagesResponse, error)`

**get** `/v1/sequences/{id}/messages`

Returns a paginated list of a sequence’s messages: every outbound email and LinkedIn message, and each enrollment’s first reply. Results are sorted by `createdAt`, newest first. Superseded outbound attempts are not included, and list items omit content; retrieve a message to read it. Use `offset` and `limit` to paginate through results, and bracketed filters to narrow the list. See <u>[List endpoints](/using-the-api/list-endpoints/)</u> for more information about pagination.

Supported filters: `contactId`, `enrollmentId`, `sequenceStepId`, `sequenceStepType` (EMAIL, LINKEDIN_MESSAGE, LINKEDIN_INVITE), `channel` (EMAIL, LINKEDIN), `direction` (OUTBOUND, INBOUND) and `status` (AWAITING_REVIEW, SCHEDULED, QUEUED, SENT, SKIPPED, FAILED, CANCELLED), with `[equal]` or no operator; and `sentAt`, `openedAt`, `readAt`, `repliedAt`, `bouncedAt`, `acceptedAt` or `receivedAt` with `[greaterThan]`, `[greaterThanOrEqual]`, `[lessThan]` or `[lessThanOrEqual]` (ISO 8601 timestamps with a timezone). Filters are combined with AND; a `status` filter excludes incoming replies.

**[Required scope](/using-the-api/scopes/):** `sequences:read`

**[Rate limit category](/using-the-api/rate-limits/):** Search

### Parameters

- `id string`

  Unique identifier of the sequence.

- `query SequenceListMessagesParams`

  - `Limit param.Field[int64]`

    Maximum number of records to return. Defaults to 25, maximum 25.

  - `Offset param.Field[int64]`

    Number of records to skip for pagination. Defaults to 0.

### Returns

- `type SequenceListMessagesResponse struct{…}`

  - `Data []SequenceListMessagesResponseDataUnion`

    - `type SequenceListMessagesResponseDataOutboundMessage struct{…}`

      - `ID string`

        Unique identifier of the message.

      - `AcceptedAt string`

        When the connection request was accepted; null until then.

      - `BouncedAt string`

        When the email bounced; null until then.

      - `Channel string`

        Channel the message went over.

        - `const SequenceListMessagesResponseDataOutboundMessageChannelEmail SequenceListMessagesResponseDataOutboundMessageChannel = "EMAIL"`

        - `const SequenceListMessagesResponseDataOutboundMessageChannelLinkedin SequenceListMessagesResponseDataOutboundMessageChannel = "LINKEDIN"`

      - `ContactID string`

        ID of the contact.

      - `CreatedAt string`

        When the message was created, or when a reply was received. Lists sort by this field, newest first.

      - `Direction string`

        Always `OUTBOUND`.

        - `const SequenceListMessagesResponseDataOutboundMessageDirectionOutbound SequenceListMessagesResponseDataOutboundMessageDirection = "OUTBOUND"`

      - `EnrollmentID string`

        ID of the enrollment the message belongs to.

      - `OpenedAt string`

        When the email was opened; null until then.

      - `ReadAt string`

        When the LinkedIn message was read; null until then.

      - `Reference SequenceListMessagesResponseDataOutboundMessageReferenceUnion`

        The email or LinkedIn message record behind this sequence message, readable with <u>[Retrieve an email](/api/resources/email/methods/retrieve)</u> or <u>[Retrieve a message](/api/resources/message/methods/retrieve)</u> under their own scopes; null when there is none.

        - `type SequenceListMessagesResponseDataOutboundMessageReferenceEmail struct{…}`

          - `ID string`

            ID of the email.

          - `ObjectType string`

            Always `email`.

            - `const SequenceListMessagesResponseDataOutboundMessageReferenceEmailObjectTypeEmail SequenceListMessagesResponseDataOutboundMessageReferenceEmailObjectType = "email"`

        - `type SequenceListMessagesResponseDataOutboundMessageReferenceMessage struct{…}`

          - `ID string`

            ID of the message.

          - `ObjectType string`

            Always `message`.

            - `const SequenceListMessagesResponseDataOutboundMessageReferenceMessageObjectTypeMessage SequenceListMessagesResponseDataOutboundMessageReferenceMessageObjectType = "message"`

      - `RepliedAt string`

        When the contact replied to this message; null until then.

      - `SentAt string`

        When the message was sent; null until then.

      - `SequenceStepID string`

        ID of the step that sent the message or, for a reply, the step it replied to.

      - `SequenceStepType string`

        Type of that step.

        - `const SequenceListMessagesResponseDataOutboundMessageSequenceStepTypeEmail SequenceListMessagesResponseDataOutboundMessageSequenceStepType = "EMAIL"`

        - `const SequenceListMessagesResponseDataOutboundMessageSequenceStepTypeLinkedinMessage SequenceListMessagesResponseDataOutboundMessageSequenceStepType = "LINKEDIN_MESSAGE"`

        - `const SequenceListMessagesResponseDataOutboundMessageSequenceStepTypeLinkedinInvite SequenceListMessagesResponseDataOutboundMessageSequenceStepType = "LINKEDIN_INVITE"`

      - `Status string`

        `AWAITING_REVIEW` is waiting for approval; `SCHEDULED` is composed and waiting for its send time; `QUEUED` is due and waiting on the sender. `SENT`, `SKIPPED`, `FAILED` and `CANCELLED` are final.

        - `const SequenceListMessagesResponseDataOutboundMessageStatusAwaitingReview SequenceListMessagesResponseDataOutboundMessageStatus = "AWAITING_REVIEW"`

        - `const SequenceListMessagesResponseDataOutboundMessageStatusScheduled SequenceListMessagesResponseDataOutboundMessageStatus = "SCHEDULED"`

        - `const SequenceListMessagesResponseDataOutboundMessageStatusQueued SequenceListMessagesResponseDataOutboundMessageStatus = "QUEUED"`

        - `const SequenceListMessagesResponseDataOutboundMessageStatusSent SequenceListMessagesResponseDataOutboundMessageStatus = "SENT"`

        - `const SequenceListMessagesResponseDataOutboundMessageStatusSkipped SequenceListMessagesResponseDataOutboundMessageStatus = "SKIPPED"`

        - `const SequenceListMessagesResponseDataOutboundMessageStatusFailed SequenceListMessagesResponseDataOutboundMessageStatus = "FAILED"`

        - `const SequenceListMessagesResponseDataOutboundMessageStatusCancelled SequenceListMessagesResponseDataOutboundMessageStatus = "CANCELLED"`

      - `StatusChangedAt string`

        When `status` last changed.

    - `type SequenceListMessagesResponseDataReply struct{…}`

      - `ID string`

        Unique identifier of the message.

      - `Channel string`

        Channel the message went over.

        - `const SequenceListMessagesResponseDataReplyChannelEmail SequenceListMessagesResponseDataReplyChannel = "EMAIL"`

        - `const SequenceListMessagesResponseDataReplyChannelLinkedin SequenceListMessagesResponseDataReplyChannel = "LINKEDIN"`

      - `ContactID string`

        ID of the contact.

      - `CreatedAt string`

        When the message was created, or when a reply was received. Lists sort by this field, newest first.

      - `Direction string`

        Always `INBOUND`.

        - `const SequenceListMessagesResponseDataReplyDirectionInbound SequenceListMessagesResponseDataReplyDirection = "INBOUND"`

      - `EnrollmentID string`

        ID of the enrollment the message belongs to.

      - `ReceivedAt string`

        When the reply was received.

      - `Reference SequenceListMessagesResponseDataReplyReferenceUnion`

        The email or LinkedIn message record behind this sequence message, readable with <u>[Retrieve an email](/api/resources/email/methods/retrieve)</u> or <u>[Retrieve a message](/api/resources/message/methods/retrieve)</u> under their own scopes; null when there is none.

        - `type SequenceListMessagesResponseDataReplyReferenceEmail struct{…}`

          - `ID string`

            ID of the email.

          - `ObjectType string`

            Always `email`.

            - `const SequenceListMessagesResponseDataReplyReferenceEmailObjectTypeEmail SequenceListMessagesResponseDataReplyReferenceEmailObjectType = "email"`

        - `type SequenceListMessagesResponseDataReplyReferenceMessage struct{…}`

          - `ID string`

            ID of the message.

          - `ObjectType string`

            Always `message`.

            - `const SequenceListMessagesResponseDataReplyReferenceMessageObjectTypeMessage SequenceListMessagesResponseDataReplyReferenceMessageObjectType = "message"`

      - `SequenceStepID string`

        ID of the step that sent the message or, for a reply, the step it replied to.

      - `SequenceStepType string`

        Type of that step.

        - `const SequenceListMessagesResponseDataReplySequenceStepTypeEmail SequenceListMessagesResponseDataReplySequenceStepType = "EMAIL"`

        - `const SequenceListMessagesResponseDataReplySequenceStepTypeLinkedinMessage SequenceListMessagesResponseDataReplySequenceStepType = "LINKEDIN_MESSAGE"`

        - `const SequenceListMessagesResponseDataReplySequenceStepTypeLinkedinInvite SequenceListMessagesResponseDataReplySequenceStepType = "LINKEDIN_INVITE"`

  - `Object SequenceListMessagesResponseObject`

    - `const SequenceListMessagesResponseObjectList SequenceListMessagesResponseObject = "list"`

  - `TotalCount int64`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/Lightfld/lightfield-go"
  "github.com/Lightfld/lightfield-go/option"
)

func main() {
  client := githubcomlightfldlightfieldgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  sequenceListMessagesResponse, err := client.Sequence.ListMessages(
    context.TODO(),
    "id",
    githubcomlightfldlightfieldgo.SequenceListMessagesParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", sequenceListMessagesResponse.Data)
}
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "acceptedAt": "acceptedAt",
      "bouncedAt": "bouncedAt",
      "channel": "EMAIL",
      "contactId": "contactId",
      "createdAt": "createdAt",
      "direction": "OUTBOUND",
      "enrollmentId": "enrollmentId",
      "openedAt": "openedAt",
      "readAt": "readAt",
      "reference": {
        "id": "id",
        "objectType": "email"
      },
      "repliedAt": "repliedAt",
      "sentAt": "sentAt",
      "sequenceStepId": "sequenceStepId",
      "sequenceStepType": "EMAIL",
      "status": "AWAITING_REVIEW",
      "statusChangedAt": "statusChangedAt"
    }
  ],
  "object": "list",
  "totalCount": -9007199254740991
}
```
