WTS Chat icon

WTS Chat

Get data from Wts API

Overview

The "Send Template In Session" operation for the Session resource in the WTS Chat n8n node allows you to send a pre-defined message template to an active chat session. This is particularly useful for automating customer support, marketing campaigns, or transactional notifications where standardized messages (templates) need to be sent to users within ongoing sessions.

Common scenarios:

  • Sending order confirmations, appointment reminders, or support responses using templates.
  • Automating follow-up messages in customer service workflows.
  • Delivering rich content (including files) as part of a templated message during a live chat session.

Practical example:
A customer support agent wants to send a "Thank you for contacting us" template with dynamic parameters (like customer name and ticket number) and an attached PDF invoice to a user in an ongoing WhatsApp session.


Properties

Display Name Type Description
Session ID String The unique identifier of the session to which the template will be sent.
Url String (Optional) URL of a file to attach to the template message.
Input Field File Name String (Optional) The name of the input field containing the base64 string to convert to a file. Use dot-notation for nested fields if needed.
Send Synchronous Message Boolean Whether to send the message synchronously (wait for delivery confirmation before proceeding).
Template Name or ID Options Select or specify the template to use. Populated dynamically based on the session.
Params Collection Key-value pairs for template parameters. Each parameter has a "Name or ID" (selectable from the template definition) and a "Value" to substitute.

Output

  • The output is a single JSON object per execution, representing the result of sending the template message in the session.
  • Typical fields in the output may include:
    • id: Unique identifier of the sent message.
    • status: Delivery status (e.g., "sent", "queued").
    • sessionId: The session to which the message was sent.
    • templateId: The template used.
    • parameters: The parameters passed to the template.
    • fileId/fileUrl: If a file was attached, its reference.
    • timestamp: When the message was sent.
    • Additional metadata as provided by the WTS API.

Note:
If a file is attached via the "Input Field File Name" property, the node expects binary data in the input. The output will still be JSON, but may reference the uploaded file by ID or URL.


Dependencies

  • External Service: Requires access to the WTS Chat API.
  • API Key: You must configure valid WTS API credentials (wtsApi) in your n8n instance.
  • n8n Configuration: If sending files, ensure that the previous node provides the required binary data under the specified field name.

Troubleshooting

Common Issues:

  • Missing Session ID: If "Session ID" is empty, the node will throw an error:
    "SessionID is empty! Fill in the SessionID field."
  • Invalid Template: If no template is selected or the value is "NOT_SEND", you'll see:
    "Choose a valid template. Choose a valid template."
  • File Attachment Errors:
    • If "Input Field File Name" is set but no binary data is present in the input, error:
      "There is no data in the input."
    • If the specified binary field does not exist, error:
      "There is no file with that name that comes from input."

How to resolve:

  • Double-check that all required fields are filled.
  • Ensure the correct template is selected and available for the session.
  • If attaching a file, verify that the previous node outputs binary data with the expected field name.

Links and References


Discussion