---
title: entities.textMessage
description: Read text message records with the textMessage repository, and change them with the text message mutations. Same records as the REST TextMessages entity.
canonical: https://developers.coevera.com/reference/graphql/text-message/
section: graphql
verification: schema
generatedFrom: schema f155746 (2026-10-20)
publisher: Coevera
---

# entities.textMessage

Read text message records with the textMessage repository, and change them with the text message mutations. Same records as the REST TextMessages entity.

REST: [TextMessages](https://developers.coevera.com/reference/rest/text-messages.md).

## Queries

- `getById(entityId: ID!): TextMessageEntity` Returns the record with the given id, or null when there is none. Deleted records are returned as well.
- `getByIds(entityIds: [ID!]!): [TextMessageEntity!]!` Returns the records with the given ids; ids without a record are left out. Deleted records are returned as well.
- `getAll(limit: Int, offset: Int, filter: TextMessageFilterInput, orderBy: [TextMessageOrderByInput!], includeDeleted: Boolean): [TextMessageEntity!]!` Returns the records that match the filter, paged with limit and offset.
- `getByCriteria(filter: TextMessageFilterInput, orderBy: [TextMessageOrderByInput!], includeDeleted: Boolean, before: String, after: String, first: Int, last: Int): TextMessageEntityConnection` Returns the records that match the filter as a cursor-paginated connection.
- `getChangedFieldsSinceRevision(id: UUID!, revision: Int!): [UUID!]!` Returns the ids of the fields of a record that changed after the given revision. Returns an empty list for entities without change tracking.

## Mutations

- `createTextMessage(input: CreateTextMessageInput!, validationLevel: [ValidationLevel!]): CreateTextMessagePayload` Create one record.
- `updateTextMessage(input: UpdateTextMessageInput!, validationLevel: [ValidationLevel!], sessionIdToUpdate: String): UpdateTextMessagePayload` Update fields.

## Types

### TextMessageEntityConnection (object)

Paginated list of TextMessage records.

- `pageInfo: PageInfo!` Pagination data for this connection.
- `edges: [TextMessageEntityEdge]!` Contains the nodes in this connection.
- `totalCount: Int` Total number of items in the connection.

### TextMessageEntityEdge (object)

A Relay edge containing a `TextMessageEntity` and its cursor.

- `node: TextMessageEntity` The item at the end of the edge
- `cursor: String!` A cursor for use in pagination

### TextMessageFilterInput (input)

Filter conditions for TextMessage records. Conditions on different fields are combined with AND; use OR, AND and NOT for other combinations.

- `OR: [TextMessageFilterInput!]` Matches records that meet at least one of the listed filters.
- `AND: [TextMessageFilterInput!]` Matches records that meet all of the listed filters.
- `NOT: TextMessageFilterInput` Matches records that do not meet this filter.
- `globalSearchQuery: String` Search term matched against the fields that the global search covers for this entity.
- `id: EntityFilterStringField` Unique identifier of entity.
- `isDeleted: Boolean` Specifies if the entity is considered deleted.
- `modified: EntityFilterDateTimeField` Last modification time.
- `created: EntityFilterDateTimeField` Creation time.
- `chatConversationId: EntityFilterStringField` Id of the AI assistant chat conversation this message belongs to, when applicable.
- `content: EntityFilterStringField` Body of the message. May be plain text or a JSON payload (e.g. AI assistant examples / suggestions).
- `datetimeSent: EntityFilterDateTimeField` Timestamp the message was sent.
- `direction: EmailDirectionEnumFilterInput` Direction of the message (Incoming, Outgoing).
- `messageSid: EntityFilterStringField` External message identifier from the SMS provider (e.g. Twilio Message SID).
- `status: TextMessageStatusEnumFilterInput` Delivery status of the message: Sending, Sent, Seen or Failed for outgoing messages, Received for incoming ones.
- `textMessageConversationId: EntityFilterStringField` Id of the text message conversation this message belongs to, or empty for AI assistant chat messages.
- `revision: EntityFilterNumberField` Revision when entity was lastly changed.
- `chatConversation: ChatConversationFilterInput` AI assistant chat conversation this message belongs to, when applicable. Matches records where a related record meets these conditions.
- `textMessageConversation: TextMessageConversationFilterInput` Conversation this message belongs to. Empty for messages produced by AI chat that do not belong to a thread of customer conversation. Matches records where a related record meets these conditions.
- `attachments: CloudObjectRelationFilterInput` Files attached to the message (e.g. MMS attachments). Matches records where a related record meets these conditions.

### TextMessageOrderByInput (input)

Sorting of TextMessage records. Set exactly one field in each item; list several items to sort by more fields, in order of priority.

- `id: OrderByEnum` Unique identifier of entity.
- `isDeleted: OrderByEnum` Specifies if the entity is considered deleted.
- `modified: OrderByEnum` Last modification time.
- `created: OrderByEnum` Creation time.
- `chatConversation: [ChatConversationOrderByNestedInput!]` AI assistant chat conversation this message belongs to, when applicable. Sorts by fields of the related record, listed in order of priority.
- `textMessageConversation: [TextMessageConversationOrderByNestedInput!]` Conversation this message belongs to. Empty for messages produced by AI chat that do not belong to a thread of customer conversation. Sorts by fields of the related record, listed in order of priority.
- `chatConversationId: OrderByEnum` Id of the AI assistant chat conversation this message belongs to, when applicable.
- `content: OrderByEnum` Body of the message. May be plain text or a JSON payload (e.g. AI assistant examples / suggestions).
- `datetimeSent: OrderByEnum` Timestamp the message was sent.
- `direction: OrderByEnum` Direction of the message (Incoming, Outgoing).
- `messageSid: OrderByEnum` External message identifier from the SMS provider (e.g. Twilio Message SID).
- `status: OrderByEnum` Delivery status of the message: Sending, Sent, Seen or Failed for outgoing messages, Received for incoming ones.
- `textMessageConversationId: OrderByEnum` Id of the text message conversation this message belongs to, or empty for AI assistant chat messages.
- `revision: OrderByEnum` Revision when entity was lastly changed.

### TextMessageStatusEnumFilterInput (input)

Conditions on an enumeration field. Several conditions given together must all match.

- `eq: [TextMessageStatusEnum!]` Matches any of the listed values.
- `NOT: TextMessageStatusEnumFilterInput` Matches values that do not meet this condition.

### ChatConversationOrderByNestedInput (input)

Sorting by a field of the related ChatConversation record. Set exactly one field in each item.

- `id: OrderByEnum` Unique identifier of entity.
- `isDeleted: OrderByEnum` Specifies if the entity is considered deleted.
- `modified: OrderByEnum` Last modification time.
- `created: OrderByEnum` Creation time.
- `ownerId: OrderByEnum` Id of the owning user.
- `type: OrderByEnum` Kind of AI chat: a general conversation with the AI assistant, or one about a specific record identified by context.

### CreateTextMessageInput (input)

Field values of a new TextMessage record.

- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).
- `modified: DateTime` Last modification time.
- `created: DateTime` Creation time.
- `chatConversationId: ID` Id of the AI assistant chat conversation this message belongs to, when applicable.
- `content: String!` Body of the message. May be plain text or a JSON payload (e.g. AI assistant examples / suggestions).
- `datetimeSent: DateTime` Timestamp the message was sent.
- `direction: EmailDirectionEnum!` Direction of the message (Incoming, Outgoing).
- `messageSid: String` External message identifier from the SMS provider (e.g. Twilio Message SID).
- `score: Int` Quality score given to the message by the user (e.g. for AI-suggested replies). Used to feed back into the suggestion engine.
- `status: TextMessageStatusEnum` Delivery status of the message: Sending, Sent, Seen or Failed for outgoing messages, Received for incoming ones.
- `textMessageConversationId: ID` Id of the text message conversation this message belongs to, or empty for AI assistant chat messages.
- `revision: Int` Revision when entity was lastly changed.
- `attachments: [CreateCloudObjectRelationNoBackrefInput!]` Files attached to the message (e.g. MMS attachments).

### UpdateTextMessageInput (input)

Id of a TextMessage record and the field values to change.

- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).
- `id: ID!` Unique identifier of entity.
- `modified: DateTime` Last modification time.
- `created: DateTime` Creation time.
- `chatConversationId: ID` Id of the AI assistant chat conversation this message belongs to, when applicable.
- `content: String` Body of the message. May be plain text or a JSON payload (e.g. AI assistant examples / suggestions).
- `datetimeSent: DateTime` Timestamp the message was sent.
- `direction: EmailDirectionEnum` Direction of the message (Incoming, Outgoing).
- `messageSid: String` External message identifier from the SMS provider (e.g. Twilio Message SID).
- `score: Int` Quality score given to the message by the user (e.g. for AI-suggested replies). Used to feed back into the suggestion engine.
- `status: TextMessageStatusEnum` Delivery status of the message: Sending, Sent, Seen or Failed for outgoing messages, Received for incoming ones.
- `textMessageConversationId: ID` Id of the text message conversation this message belongs to, or empty for AI assistant chat messages.
- `revision: Int` Revision when entity was lastly changed.
- `attachments: [CreateCloudObjectRelationNoBackrefInput!]` Files attached to the message (e.g. MMS attachments).

### CreateTextMessagePayload (object)

Result of the createTextMessage mutation.

- `textMessage: TextMessageEntity` The created record.
- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).

### UpdateTextMessagePayload (object)

Result of the updateTextMessage mutation.

- `textMessage: TextMessageEntity` The updated record.
- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).

### TextMessageStatusEnum (enum)

Delivery status of a text, WhatsApp or chat message.

- `Sending` Outgoing message is queued or being sent.
- `Sent` Message was sent.
- `Failed` Message could not be sent.
- `Received` Message was received from the other party.
- `Seen` The recipient has seen the sent message.

Types several repositories share, such as `PageInfo` and the filter fields, are in the [types index](https://developers.coevera.com/reference/graphql/types.md). The [SDL](https://developers.coevera.com/graphql/schema.graphql) has the whole schema in one file.

## Example

```graphql
query FirstTextMessages {
  entities {
    textMessage {
      getByCriteria(first: 3, orderBy: [{ modified: Desc }]) {
        totalCount
        edges { node { id modified } }
      }
    }
  }
}
```

```bash
curl 'https://{region}.api.coevera.com/api/v100/app/space/{space_id}/graphql/public' \
  --user "$COEVERA_API_KEY:$COEVERA_API_SECRET" \
  --header 'Content-Type: application/json' \
  --data '{"query":"query FirstTextMessages { entities { textMessage { getByCriteria(first: 3, orderBy: [{ modified: Desc }]) { totalCount edges { node { id modified } } } } } }"}'
```
