WTS Chat icon

WTS Chat

Get data from Wts API

Overview

This node integrates with the WTS Chat API to manage contacts within a CRM or messaging system. Specifically, the Create Contact operation allows users to add new contacts to the database or update existing ones based on specified criteria.

Typical use cases include:

  • Adding new leads or customers into the contact database automatically from form submissions or other sources.
  • Updating existing contact information if the contact already exists (using upsert).
  • Tagging contacts for segmentation or marketing purposes.
  • Enriching contacts with custom fields and metadata for better personalization and tracking.

For example, you might use this node to create a contact with their name, email, phone number, Instagram handle, and assign tags like "VIP" or "Newsletter Subscriber". You can also add notes (annotations) or custom metadata such as customer preferences.

Properties

Name Meaning
Name The full name of the contact to create.
Tag Names or IDs Tags to assign to the contact. Choose from a list or specify tag IDs via expressions. Tags help categorize or segment contacts.
Phone Number The contact's phone number.
E-Mail The contact's email address. Must be a valid email format.
Instagram The Instagram username of the contact.
Annotation A note or comment about the contact. Useful for internal remarks or additional info.
Upsert Boolean flag. If enabled, the node will update an existing contact if found instead of creating a duplicate.
Get If Exists? Boolean flag. If enabled, the node will return the existing contact without updating it if it already exists.
Custom Fields Allows adding multiple custom key-value pairs to enrich the contact with additional structured data. Keys can be selected from predefined custom fields or specified by ID.
Metadata Additional metadata key-value pairs to attach to the contact. This is flexible data that can be used for various integrations or internal tracking.

Output

The node outputs JSON data representing the created or updated contact object returned from the WTS API. This includes all standard contact fields plus any custom fields and metadata that were set.

The output structure typically contains:

  • Contact identifiers (e.g., contact ID)
  • Basic contact details (name, email, phone, Instagram)
  • Tags assigned
  • Annotations/notes
  • Custom fields and metadata objects
  • Status and timestamps related to the contact record

No binary data output is produced by this operation.

Dependencies

  • Requires an active connection to the WTS Chat API using an API key credential configured in n8n.
  • The API key must have permissions to create and update contacts.
  • The node uses internal services (WtsCoreService) to interact with the API endpoints.

Troubleshooting

  • Invalid email error: If the email property is provided but does not match a valid email regex pattern, the node throws an error "Invalid email!". Ensure emails are correctly formatted.
  • API errors: Any issues communicating with the WTS API (e.g., invalid API key, network issues) will result in errors wrapped as NodeApiError. Check your credentials and network connectivity.
  • Missing required fields: While most fields are optional, providing at least one unique identifier (like phone or email) helps avoid duplicates or errors.
  • Upsert conflicts: When using the upsert option, ensure the contact identification logic matches your expectations to prevent unintended overwrites.
  • Expression errors: When specifying tag IDs or custom field keys via expressions, ensure the expressions resolve correctly to valid values.

Links and References

Discussion