WTS Chat icon

WTS Chat

Get data from Wts API

Overview

The Get All Messages operation for the Message resource in the WTS Chat n8n node retrieves a list of messages associated with a specific session. This is useful for automating workflows that need to analyze, archive, or process chat histories from customer support, sales conversations, or any other messaging context managed through WTS Chat.

Practical examples:

  • Fetching all messages from a customer support session for sentiment analysis.
  • Archiving chat transcripts for compliance or training purposes.
  • Triggering follow-up actions based on message content or timing.

Properties

Below are the input properties relevant to the "Get All Messages" operation:

Display Name Type Meaning
Session ID string The unique identifier of the session whose messages you want to retrieve. Required.
CreatedAt.After dateTime Only include messages created after this date/time. Useful for filtering recent messages.
CreatedAt.Before dateTime Only include messages created before this date/time.
UpdatedAt.After dateTime Only include messages updated after this date/time.
UpdatedAt.Before dateTime Only include messages updated before this date/time.
Auto Pagination boolean If enabled, automatically fetches multiple pages of results.
Max Pages number Maximum number of pages to fetch when auto pagination is enabled (default: 10, max: 100).
Page Number number The page number to retrieve (used if auto pagination is disabled; default: 1).
Page Size number Number of items per page (used if auto pagination is disabled; default: 15, max: 100).
Order By string Field by which to sort the results.
Order Direction options Sort direction: Ascending or Descending.

Output

The output consists of an array of objects, each representing a message from the specified session. Each object is returned under the json field.

Typical structure:

[
  {
    "json": {
      // Message fields such as:
      "id": "string",
      "sessionId": "string",
      "sender": "string",
      "content": "string",
      "createdAt": "2023-01-01T12:00:00Z",
      "updatedAt": "2023-01-01T12:05:00Z",
      // ...other message-specific fields
    }
  },
  ...
]

Note: The exact fields depend on the WTS Chat API response but generally include identifiers, sender info, content, and timestamps.

Dependencies

  • External Service: Requires access to the WTS Chat API.
  • API Key: You must configure valid WTS Chat API credentials (wtsApi) in your n8n instance.
  • n8n Configuration: No special environment variables beyond standard credential setup.

Troubleshooting

Common Issues:

  • Missing Session ID: If the "Session ID" property is empty, the node will throw an error:
    "SessionID is empty, please fill it in"
    Resolution: Ensure you provide a valid session ID.
  • Invalid Date/Time Format: If date/time filters are not in the expected format, the API may reject the request or return no results.
    Resolution: Use the format YYYY-MM-DD hh:mm and ensure time zone correctness.
  • Pagination Limits: If you set "Max Pages" too high, you may hit API rate limits or experience slow performance.
    Resolution: Adjust "Max Pages" and "Page Size" according to your needs and API limitations.
  • API Key Issues: If your API key is missing or invalid, authentication errors will occur.
    Resolution: Check your n8n credentials configuration.

Links and References

Discussion