Overview
Create or update a customer contact with intelligent AI-powered data processing. This endpoint automatically creates the contact if it doesnβt exist, or updates it if it does, along with optional metadata, stage assignment, and agent assignment - all in a single request. The AI automatically processes and structures any unstructured data you provide in the metadata, making it perfect for importing customer data from external sources.Use Cases
- CRM Data Import: Bulk import customer data from external CRM systems
- Form Submissions: Create customers from web form submissions with flexible data
- E-commerce Integration: Sync customer data from your e-commerce platform
- Lead Capture: Capture leads with any structure of data
- Customer Onboarding: Create customer profiles during signup flows
- Data Migration: Migrate customer data from legacy systems
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Request Body
Field | Type | Required | Description |
---|---|---|---|
channel_phone_number | string | Yes | Your WhatsApp channel phone number (the sender) |
channel | string | Yes | Channel type: βwhatsappβ or βweb-whatsappβ |
contact_phone_number | string | No | Customerβs phone number (can also be in meta_data) |
contact_name | string | No | Customerβs full name |
contact_email | string | No | Customerβs email address |
stageId | string | No | Pipeline stage UUID to assign the customer to |
agentId | string | No | Team member UUID to assign as responsible agent |
meta_data | object | No | Any additional customer data (AI will structure it) |
Response Structure
Returns the created or updated AI contact object:Field | Type | Description |
---|---|---|
id | string (UUID) | Unique identifier for the contact |
name | string | Contactβs name |
phone | string | Contactβs phone number |
email | string | Contactβs email |
platform | string | Channel platform (whatsapp, web-whatsapp) |
client_id | string (UUID) | Your organization ID |
ai_customer_id | string (UUID) | Associated customer profile ID |
created_at | string (ISO) | Contact creation timestamp |
default_stage_id | string (UUID) | Current pipeline stage (if assigned) |
Example Request
Example Response
Common Use Cases
1. Import CRM Data with Flexible Structure
2. Process Form Submission
3. E-commerce Customer Sync
4. Bulk Customer Import
5. Upsert with Flexible Phone Number
Key Features
π€ AI-Powered Data Processing
The endpoint uses AI to:- Extract structured data from unstructured metadata
- Match fields to your custom field definitions
- Convert data types automatically
- Handle flexible formats for phone numbers, dates, etc.
π Upsert Behavior
- If contact exists (by phone number): Updates the contact information
- If contact doesnβt exist: Creates a new contact
- Idempotent: Safe to call multiple times with same data
π Automatic Processing
All in one request:- β Create/update contact
- β Assign to pipeline stage
- β Assign to agent
- β Process and save metadata
Phone Number Flexibility
Thecontact_phone_number
field is optional because the AI can extract it from meta_data
:
Option 1 - Explicit phone number:
Channel Types
Channel | Description | Use When |
---|---|---|
whatsapp | WhatsApp Business API | Using official WhatsApp API |
web-whatsapp | WhatsApp Web (QR Code) | Using WhatsApp Web connection |
Error Responses
Status Code | Description |
---|---|
400 | Bad Request - Missing required fields |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Channel phone number not found |
500 | Internal Server Error - Something went wrong |
Important Notes
- Channel Phone Number: Must be a WhatsApp number/channel you own and have configured
- Phone Format: Automatically cleaned (spaces, dashes, etc. are removed)
- Upsert Logic: Contact identified by phone number - updates if exists, creates if not
- AI Processing: Metadata is processed asynchronously with AI
- Immediate Response: Returns contact immediately, metadata processing continues in background
Best Practices
1. Use Consistent Field Names
2. Include Source Information
3. Validate Data Before Sending
Related Endpoints
- POST /api/public/contact//update-metadata - Update metadata for existing contact
- POST /api/public/ticket/open/web-whatsapp/ - Create ticket for contact
- GET /api/public/contact//info - Get contact details
Migration from Deprecated Endpoint
If youβre migrating from the deprecatedPOST /api/public/whatsapp/message/note/send
endpoint:
Old:
Headers
API key needed to authorize the request
Body
application/json
The phone number of the channel you want associate with the user
Minimum length:
1
Channel you want associate with the user
Available options:
whatsapp
, web-whatsapp
Phone number you want associate with the user
Stage ID you want associate with the user
Agent ID you want associate with the user
Email you want associate with the user
Name you want associate with the user
Response
Message sent successfully.