WTS Chat icon

WTS Chat

Get data from Wts API

Overview

The "Send Template To Contact" operation in the WTS Chat n8n node allows you to send a pre-defined message template (which may include text, media, and parameters) to a specific contact via a selected channel. This is particularly useful for automating customer communication workflows, such as sending appointment reminders, promotional messages, or transactional notifications using WhatsApp or similar messaging platforms.

Practical scenarios:

  • Sending personalized marketing templates to customers.
  • Delivering order confirmations or status updates with dynamic content.
  • Automating follow-up messages that require parameterized templates.

Properties

Below are the input properties relevant to the "Message" resource and "Send Template To Contact" operation:

Display Name Type Description
Chatbot Name or ID options Select or specify the chatbot to use for this message.
Department Name or ID options Select or specify the department; can be used to route the message.
User Name or ID options Select or specify the user within the chosen department.
From Name or ID options The channel from which the message will be sent (e.g., WhatsApp number/account).
Templates Name or ID options Choose the template to send. Must be selected; otherwise, the node will throw an error.
Params fixedCollection Key-value pairs for template parameters. Each param has a name (from template definition) and a value.
To string The recipient's phone number or username.
Url string URL of a file to attach if the template requires a file.
Input Field File Name string Name of the binary input field containing the file to send (if applicable).
Send Synchronous Message boolean Whether to send the message synchronously (wait for response before proceeding).
Enable Bot boolean If enabled, activates the chatbot upon receiving a response from the contact.
Hidden Session boolean If enabled, the session will be hidden.
Force Start Session boolean Forces the start of a new session for this message.

Output

  • The output is a single item per execution, under the json property.
  • The structure of the output reflects the API response from the template message send action. Typically, it includes:
    • Message ID
    • Status
    • Timestamps
    • Recipient information
    • Any additional metadata returned by the WTS API

Example output structure:

{
  "json": {
    "id": "message_id",
    "status": "sent",
    "to": "+1234567890",
    "templateId": "template_id",
    "parameters": {
      "param1": "value1",
      "param2": "value2"
    },
    "timestamp": "2024-06-01T12:00:00Z",
    ...
  }
}
  • If a file is attached, the output will reference the file ID or URL as handled by the API, but the node does not output binary data directly.

Dependencies

  • External Service: Requires access to the WTS Chat API.
  • API Key: You must configure valid credentials (wtsApi) in n8n for authentication.
  • Environment: Internet access to reach the WTS API endpoint.

Troubleshooting

Common issues:

  • Missing Required Fields:

    • If "Templates Name or ID" is not set, the node throws:
      "Choose template" / "Fill in the Template field"
    • If "From Name or ID" (channel) is not set, the node throws:
      "Choose channel" / "Fill in the From field"
    • If "To" (recipient) is empty, the node throws:
      "Set an Instagram number or username for sending" / "Fill in the To field"
  • File Attachment Errors:

    • If a file is required but not provided, or the specified binary field is missing, errors like:
      "There is no data in the input" or
      "There is no file with that name that comes from input"
  • Parameter Issues:

    • If template parameters are missing or mismatched, the message may fail to send or be rejected by the API.

How to resolve:

  • Double-check all required fields are filled.
  • Ensure the correct template and channel are selected.
  • For file attachments, verify the binary input field name matches the incoming data.
  • Make sure your API credentials are valid and have sufficient permissions.

Links and References


Discussion