Skip to main content

04.6.2.18 List Messages

Node Description

List Messages is an action type node for getting a filtered list of ChatGPT chat messages according to thread.

Node Configuration

To configure the List Messages node, you must fill in the required and optional fields.

The required* fields include:

  • API Key;
  • Thread ID.

API Key

The field required for entering the API key (see more details here).

Thread ID

The field required to specify the ID of the thread to messages should be received.

Limit

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

Order

Drop-down list for selecting the sort order. Two values are available for selection: Ascending order, Descending order. If the parameter is not selected, the values will be sorted in the desc order.

After

A cursor for use in pagination. Object ID (Message ID) that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

Before

A cursor for use in pagination. Object ID (Message ID) that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

Example of launching a node

It is necessary to run the node List Messages once with the parameters:

  • API Key - Your API key;
  • Thread ID - Your Thread ID;
  • Limit - 2;
  • Order - Ascending order.

The result of the List Messages node execution is a list of messages, including attributes for each message:

  • assistant_id,
  • content,
  • created_at,
  • file_ids,
  • id,
  • metadata,
  • object: thread.message,
  • role: user or assistant,
  • run_id,
  • thread_id.