TwentyDEV icon

TwentyDEV

Consume the Twenty API

Actions252

Overview

This node operation, Find Many Messages, retrieves multiple message objects from the connected service. It is useful for scenarios where you need to fetch a list of messages with various filtering, sorting, and pagination options. For example, you might use it to display recent chat messages, retrieve notifications, or gather communication logs filtered by specific criteria.

Properties

Name Meaning
Order By Sorts the returned messages by specified fields. The format is field_name_1,field_name_2[DIRECTION_2],.... Directions can be: AscNullsFirst, AscNullsLast, DescNullsFirst, DescNullsLast. Default direction is AscNullsFirst. Example: createdAt,usernameDescNullsLast sorts first by creation date ascending, then username descending. Default is id.
Filter Filters the messages returned based on field comparators. Format: field[COMPARATOR]:value. Comparators include eq, neq, in, containsAny, is, gt, gte, lt, lte, startsWith, like, ilike. Supports logical conjunctions (and, or, not). Can filter null values using field[is]:NULL or field[is]:NOT_NULL. Boolean filters also supported. Default excludes messages with id equal to all zeros UUID.
Limit Limits the number of messages returned. Default is 60.
Depth Controls how deeply nested related objects are included in the response: 0 = only primary message data; 1 = primary message plus directly related objects; 2 = primary message, related objects, and their related objects. Default is 1.
Starting After Returns messages starting after a specific cursor value, used for pagination. Cursor values come from startCursor or endCursor in the response's pageInfo.
Ending Before Returns messages ending before a specific cursor value, also for pagination. Cursor values come from startCursor or endCursor in the response's pageInfo.

Output

The node outputs JSON data containing an array of message objects matching the query parameters. Each message object includes its fields and, depending on the Depth parameter, may include nested related objects up to two levels deep. Pagination information such as cursors (startCursor, endCursor) and page info is also included to facilitate further paginated requests.

If binary data is present in messages (e.g., attachments), it would be represented accordingly, but this operation primarily returns structured JSON message data.

Dependencies

  • Requires connection to the Twenty API service.
  • Needs an API authentication token or API key credential configured in n8n to authorize requests.
  • The base URL for the API is set dynamically from credentials.
  • Uses standard HTTP headers for JSON content negotiation.

Troubleshooting

  • Invalid filter syntax: If the filter string is malformed or uses unsupported comparators, the API may return errors. Ensure filters follow the documented format and use valid comparator keywords.
  • Pagination cursors invalid or expired: Using outdated or incorrect cursor values in starting_after or ending_before will cause no results or errors. Always use cursors returned from the previous response.
  • Authentication errors: Missing or invalid API credentials will result in authorization failures. Verify that the API key/token is correctly configured.
  • Limit too high: Setting the limit above the allowed maximum (if any) may cause errors or truncated responses. Use reasonable limits.
  • Depth too large: Requesting depth beyond supported levels may lead to incomplete data or errors.

Links and References

Discussion