WTS Chat icon

WTS Chat

Get data from Wts API

Overview

The UpdateSession operation for the Session resource in this n8n node allows you to update various fields of an existing session in the WTS Chat system. This is useful for managing and maintaining session data, such as changing its status, assigning it to a different department or user, updating metadata, or setting an end time.

Common scenarios:

  • Changing the status of a session (e.g., marking it as completed or in progress).
  • Assigning a session to a new department or user.
  • Updating session metadata with custom key-value pairs.
  • Modifying the session's end time or associated number.

Practical examples:

  • Automatically closing sessions that have been inactive for a certain period.
  • Reassigning sessions to another department when escalation is needed.
  • Adding or updating metadata for reporting or integration purposes.

Properties

Below are the supported input properties for the UpdateSession operation:

Display Name Type Meaning / Description
Session ID string The unique identifier of the session to be updated.
Fields multiOptions Select which fields you want to update in the session. Options include: Autocomplete, DepartmentId, EndAt, Metadata, Number, ReactivateDisabled, Status, UserId.
Department Name or ID options (Shown if "DepartmentId" is selected in Fields) Choose or specify the department to assign the session to.
User Name or ID options (Shown if "UserId" is selected in Fields) Choose or specify the user to assign the session to.
EndAt dateTime (Shown if "EndAt" is selected in Fields) Set the session's end date and time (format: YYYY-MM-DD hh:mm).
Number string (Shown if "Number" is selected in Fields) Update the session's associated number.
Status Session options (Shown if "Status" is selected in Fields) Set the session's status. Options: Completed, Hidden, In Progress, Pending, Started, Undefined.
Metadata fixedCollection (Shown if "Metadata" is selected in Fields) Add or update custom metadata as key-value pairs.

Output

  • The output will be a single json object representing the updated session.
  • The structure of the output depends on the WTS Chat API response, but typically includes all session details after the update, such as:
    • Session ID
    • Updated fields (status, department, user, end time, number, metadata, etc.)
    • Timestamps and other session-related information

Example output (structure may vary):

{
  "id": "session_12345",
  "status": "COMPLETED",
  "departmentId": "dept_001",
  "userId": "user_002",
  "endAt": "2024-06-10T15:00:00Z",
  "number": "5551234567",
  "metadata": {
    "priority": "high",
    "source": "web"
  },
  ...
}

Dependencies

  • External Service: Requires access to the WTS Chat API.
  • API Key: You must configure valid credentials (wtsApi) with an API key in your n8n instance.
  • n8n Configuration: No special environment variables beyond the API key are required.

Troubleshooting

Common issues:

  • Missing Session ID: If the "Session ID" field is empty, the node will throw an error:
    "SessionID is empty! Fill in the SessionID field"
  • No Fields Selected: If no fields are selected in "Fields", nothing will be updated.
  • Invalid Status: If "Status Session" is set to "Undefined" or left blank, you may see:
    "Add a valid status!"
  • Invalid Department/User: If you select to update the department or user but do not provide a value, the update may fail.
  • Metadata Format: Ensure metadata is provided as key-value pairs; otherwise, the update may not apply as expected.

How to resolve:

  • Always provide a valid Session ID.
  • Select at least one field to update.
  • When updating status, choose a valid option.
  • For department/user updates, ensure you pick from the list or enter a valid ID.
  • Enter metadata as proper key-value pairs.

Links and References


Discussion