WTS Chat icon

WTS Chat

Get data from Wts API

Overview

The "Send File To Contact" operation of the WTS Chat node allows you to send a file (such as an image, document, or other media) to a specific contact via a selected channel (e.g., WhatsApp, Instagram). You can provide the file either by referencing a binary input field from previous nodes or by specifying a direct URL to the file. This is useful for automating customer support, marketing campaigns, or any workflow where sending files to contacts is required.

Example scenarios:

  • Sending invoices, receipts, or product brochures to customers.
  • Sharing images or documents in response to user queries.
  • Automating onboarding by sending welcome kits or guides.

Properties

Below are the supported input properties for this operation:

Display Name Type Description
Chatbot Name or ID options Choose a chatbot from the list or specify its ID. Used if you want to associate the message with a bot.
Department Name or ID options Select a department or specify its ID. Helps route the message through a specific department.
User Name or ID options Select a user within the chosen department. Useful for assigning responsibility.
From Name or ID options The channel (e.g., WhatsApp, Instagram) from which the file will be sent.
To string The recipient's number or username.
Url string Direct URL to the file to be sent.
Input Field File Name string The name of the binary input field containing the file (from previous node). Supports dot-notation.
Send Synchronous Message boolean If true, sends the message synchronously and waits for a response.
Enable Bot boolean If true, activates the chatbot upon receiving a response from the contact.
Hidden Session boolean If true, hides the session from standard views.
Force Start Session boolean If true, forces the start of a new session for the message.

Key usage notes:

  • Either Input Field File Name or Url must be provided.
  • From Name or ID (channel) and To (recipient) are mandatory.
  • Department and user fields are optional but allow for more granular routing.

Output

The output is a JSON object representing the result of the file-sending operation. Typical fields may include:

{
  "id": "message_id",
  "status": "sent",
  "to": "recipient_number",
  "from": "channel_id",
  "fileId": "uploaded_file_id",
  "fileUrl": "url_if_provided",
  "timestamp": "2024-06-01T12:34:56Z",
  // ...other metadata returned by the API
}
  • If a file is uploaded, the output includes the file's unique ID.
  • If a URL is used, the output references the URL.
  • Additional status and metadata fields may be present depending on the API response.

Binary Data:
If you use the Input Field File Name, the node expects binary data from a previous node. However, the output itself is always JSON describing the sent message; it does not output binary data.

Dependencies

  • External Service: Requires access to the WTS Chat API.
  • API Key: Must configure wtsApi credentials in n8n (API key required).
  • n8n Configuration: Ensure that binary data is passed correctly from previous nodes if using the file upload option.

Troubleshooting

Common issues:

  • Missing Channel or Recipient:

    • Error: "Choose channel" or "Set an Instagram number or username for sending"
    • Solution: Ensure both From Name or ID and To fields are filled.
  • No File Provided:

    • Error: "Fill in any of the fields, whether Url or File!"
    • Solution: Provide either a valid file input field or a file URL.
  • No Binary Data:

    • Error: "There is no data in the input" or "There is no file with that name that comes from input"
    • Solution: Check that the previous node outputs binary data with the correct field name.
  • API Errors:

    • Any error thrown by the WTS Chat API will be surfaced as a node error. Check your API key, permissions, and input values.

Links and References

Discussion