WTS Chat icon

WTS Chat

Get data from Wts API

Overview

The Get All Sessions operation for the Session resource in the WTS Chat n8n node retrieves a list of chat sessions from the WTS API. This operation is highly customizable, allowing you to filter sessions by various criteria such as tags, users, departments, contact, channels, time ranges, status, and more. It supports pagination (manual or automatic) and can include additional details about each session.

Common scenarios:

  • Monitoring all active or completed chat sessions.
  • Filtering sessions by agent, department, channel, or tag for reporting or analytics.
  • Retrieving sessions within specific date/time ranges for compliance or auditing.
  • Integrating session data into dashboards or downstream automation workflows.

Practical examples:

  • Fetch all sessions handled by a specific user in the last week.
  • List sessions tagged with "VIP" that are currently in progress.
  • Retrieve all sessions from a particular channel that ended before a certain date.

Properties

Below are the supported input properties for this operation, along with their display names, types, and meanings:

Display Name Type Meaning
Tag Names or IDs multiOptions Filter sessions by one or more tag names or IDs.
User Name or ID options Filter sessions assigned to a specific user.
Department Name or ID options Filter sessions belonging to a specific department.
Contact ID string Filter sessions associated with a specific contact.
Channel Names or IDs multiOptions Filter sessions by one or more channel names or IDs.
ActiveAt.After dateTime Only include sessions active after this date/time.
ActiveAt.Before dateTime Only include sessions active before this date/time.
EndAt.After dateTime Only include sessions that ended after this date/time.
EndAt.Before dateTime Only include sessions that ended before this date/time.
LastInteractionAt.After dateTime Only include sessions with last interaction after this date/time.
LastInteractionAt.Before dateTime Only include sessions with last interaction before this date/time.
Status Session multiOptions Filter sessions by their status (Completed, Hidden, In Progress, Pending, Started).
Include Details multiOptions Specify which additional details to include (e.g., AgentDetails, ChannelDetails, etc.).
CreatedAt.After dateTime Only include sessions created after this date/time.
CreatedAt.Before dateTime Only include sessions created before this date/time.
UpdatedAt.After dateTime Only include sessions updated after this date/time.
UpdatedAt.Before dateTime Only include sessions updated before this date/time.
Auto Pagination boolean Whether to automatically paginate through all results.
Max Pages number Maximum number of pages to retrieve (used if auto pagination is enabled).
Page Number number The page number to retrieve (used if auto pagination is disabled).
Page Size number Number of items per page (used if auto pagination is disabled).
Order By string Field to sort the results by.
Order Direction options Sort direction: Ascending or Descending.

Output

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

Structure example:

[
  {
    "json": {
      // Session fields such as:
      "id": "session_id",
      "status": "IN_PROGRESS",
      "contactId": "contact_id",
      "departmentId": "department_id",
      "userId": "user_id",
      "channelId": "channel_id",
      "activeAt": "2024-06-01T12:00:00Z",
      "endAt": "2024-06-01T13:00:00Z",
      "lastInteractionAt": "2024-06-01T12:45:00Z",
      // ...other session details depending on 'Include Details'
    }
  }
]
  • If the Include Details property is used, additional nested objects may be present (e.g., agent, channel, classification, contact, department details).

Note: This operation does not output binary data.


Dependencies

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

Troubleshooting

Common issues:

  • Missing or invalid credentials: Ensure your WTS API key is correctly configured in n8n.
  • No results returned: Check your filters; overly restrictive criteria may yield no sessions.
  • Invalid date/time format: Dates must be in YYYY-MM-DD hh:mm format and match your time zone.
  • Pagination confusion: If you enable auto pagination, ensure Max Pages is set appropriately. If disabled, set Page Number and Page Size.

Error messages:

  • "There is no data in the input": Usually occurs if required input data is missing.
  • "Fill in the field session": The session ID or another required parameter is missing.
  • "Add a valid status!": The status provided is not recognized or is left undefined.

How to resolve:

  • Double-check all required fields.
  • Use the "Expression" feature in n8n to dynamically set property values if needed.
  • Review API documentation for accepted values and formats.

Links and References

Discussion