CustomJE icon

CustomJE

Custom operations

Overview

This node operation, Get Latest Unread Messages under the ChatGPT resource, retrieves the most recent unread messages from a specified conversation thread. It allows filtering messages by the role of the sender (either "User" or "Assistant") and optionally removes a label from those messages after retrieval.

This operation is useful in scenarios where you want to programmatically monitor new incoming messages in a chat thread, for example:

  • Automatically fetching unread user queries to trigger further processing or responses.
  • Monitoring assistant replies that have not yet been reviewed.
  • Integrating with other systems to sync or archive unread messages.

Practical example:
You have a chatbot system and want to periodically fetch all unread user messages from a specific conversation thread to analyze sentiment or trigger notifications.

Properties

Name Meaning
CJ Token Your API authentication token ("CJ Token") required to access the service.
Thread ID The unique identifier of the chat thread from which to retrieve unread messages.
Role Filter messages by sender role. Options: "User" or "Assistant".
Remove Label Boolean flag indicating whether to remove the unread label from the messages after fetch.

Output

The output is a JSON array containing the latest unread messages matching the criteria. Each item in the array represents a message object returned by the external API. The exact structure depends on the API response but typically includes message content, sender role, timestamps, and possibly message IDs.

No binary data output is indicated for this operation.

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 API key credential ("CJ Token") to authenticate requests.
  • The node uses HTTP GET requests with query parameters to interact with the API.
  • No additional environment variables or n8n-specific configurations are explicitly required beyond providing the API key.

Troubleshooting

  • Common issues:

    • Invalid or missing API key will cause authentication failures.
    • Incorrect or non-existent Thread ID may result in empty results or errors.
    • Network connectivity problems can cause request timeouts or failures.
    • Providing an unsupported role value (other than "user" or "assistant") will likely yield no results.
  • Error messages:

    • If the operation is not implemented or the resource is unknown, the node throws an error indicating so.
    • API errors returned from the external service will be propagated as error messages.
    • To handle intermittent failures gracefully, enable "Continue On Fail" in the node settings.
  • Resolution tips:

    • Verify the API key and ensure it has proper permissions.
    • Double-check the Thread ID for correctness.
    • Confirm network access to the API endpoint.
    • Use the "Remove Label" option carefully; if enabled, messages will lose their unread status.

Links and References

Discussion