WTS Chat icon

WTS Chat

Get data from Wts API

Overview

This node integrates with the WTS Chat API to retrieve, send, and manage chat messages, contacts, sessions, and panel annotations. Specifically, for the Message resource with the Get All Messages operation, it fetches a paginated list of messages filtered by various criteria such as session ID, creation or update timestamps, and sorting options.

Common scenarios where this node is beneficial include:

  • Retrieving all chat messages from a specific session for analysis or reporting.
  • Fetching recent messages within a time range to monitor conversations.
  • Integrating message data into workflows for customer support automation or CRM updates.

Practical example:

  • A user wants to pull all messages from a particular chat session in the last 24 hours, sorted by creation date descending, to generate a conversation summary report.

Properties

Name Meaning
Page Number The page number of results to retrieve (pagination).
Page Size Number of messages per page (minimum 1, maximum 100).
Order By Field name to sort the messages by (e.g., creation date).
Order Direction Sorting direction: "Ascending" or "Descending".
Session ID Filter messages belonging to a specific session ID.
CreatedAt.After Filter messages created after this date/time (format: YYYY-MM-DD hh:mm).
CreatedAt.Before Filter messages created before this date/time (format: YYYY-MM-DD hh:mm).
UpdatedAt.After Filter messages updated after this date/time (format: YYYY-MM-DD hh:mm).
UpdatedAt.Before Filter messages updated before this date/time (format: YYYY-MM-DD hh:mm).

Output

The output is an array of JSON objects, each representing a message retrieved from the API. Each item contains the full message data as returned by the WTS Chat API under the json field.

Example structure of one output item (simplified):

{
  "json": {
    "id": "message-id",
    "sessionId": "session-id",
    "from": "sender-id",
    "to": "receiver-id",
    "body": {
      "text": "Message content",
      "fileUrl": "optional file URL"
    },
    "createdAt": "2024-06-01T12:00:00Z",
    "updatedAt": "2024-06-01T12:05:00Z",
    "status": "delivered",
    ...
  }
}

No binary data output is produced by this operation.

Dependencies

  • Requires an API key credential for authentication with the WTS Chat API.
  • The base URL used is https://api-test.helena.run.
  • Uses HTTP GET requests with appropriate query parameters for filtering and pagination.
  • Requires n8n credentials setup with a valid API key for the WTS Chat service.

Troubleshooting

  • Empty results: Ensure the Session ID is correct and that the date filters (CreatedAt.After, CreatedAt.Before, etc.) are set properly according to your timezone.
  • API errors or no response: Verify that the API key credential is valid and has necessary permissions.
  • Invalid date format: Date/time inputs must follow the format YYYY-MM-DD hh:mm. Incorrect formatting may cause the API to reject the request.
  • Pagination issues: If you request a page number beyond available pages, the result will be empty. Adjust Page Number and Page Size accordingly.
  • Sorting not applied: Confirm that the Order By field matches a valid sortable field supported by the API.

Links and References

Discussion