Actions13
- AI/ML Actions
- ChatGPT Actions
- Communication Actions
- Data Processing Actions
- E-Commerce Actions
- Printing Actions
- Utility Actions
Overview
The "Get All Messages By Filter" operation in the ChatGPT resource allows users to retrieve messages from a specific conversation thread, filtered by message role and sorted by time. This node is useful for scenarios where you want to analyze or process chat history selectively, such as extracting only user messages, assistant replies, or all messages within a thread. For example, it can be used to fetch the last 5 assistant responses in a conversation for sentiment analysis or to audit user inputs.
Properties
| Name | Meaning |
|---|---|
| CJ Token | Your API authentication token (CJ Token) required to access the service. |
| Thread ID | The unique identifier of the conversation thread from which to retrieve messages. |
| Role | Filter messages by role: - All - User - Assistant |
| Latest | Number of latest messages to retrieve. Use 0 to get all messages. |
| Sort | Sort order for messages: - Ascending - Descending |
Output
The output is a JSON array containing the messages retrieved from the specified thread according to the filter criteria. Each item in the array represents a message object with details such as content, role, timestamp, and other metadata as provided by the external API.
If binary data were involved, it would typically represent media attachments or files related to messages, but this operation returns only JSON message data.
Dependencies
- Requires an active internet connection to call the external API endpoint at
https://api.customje.com/get-latest-unread-message.php. - Requires a valid CJ Token (API key) for authentication.
- No additional n8n credentials or environment variables are explicitly required beyond the API key input.
Troubleshooting
Common Issues:
- Invalid or missing CJ Token will result in authentication errors.
- Incorrect Thread ID may lead to empty results or errors indicating the thread does not exist.
- Providing non-numeric or invalid values for "Latest" may cause unexpected behavior.
Error Messages:
"The operation 'get-all-messages-filter' is not implemented yet!"— indicates a misconfiguration or unsupported operation; ensure the correct operation name is selected."The resource 'chatgpt' is not known!"— indicates the resource parameter is incorrect or missing.- Network or API errors may occur if the external service is unreachable or returns an error; verify network connectivity and API status.
Resolution Tips:
- Double-check the CJ Token and Thread ID inputs.
- Ensure the "Latest" field is set to a valid number or zero.
- Verify that the external API endpoint is accessible from your environment.
Links and References
- CustomJE API Documentation (general reference for the API endpoints used)
- n8n Documentation on Creating Custom Nodes