Webchat Contacts Only: This endpoint is specifically for contacts from
your web chat widget. For other channels, use POST /api/public/contact/
/update-metadata.
Overview
Add or update metadata for a webchat contact using their external user ID. This endpoint is designed specifically for web chat widget integrations where you may have your own user identification system. Unlike the general metadata endpoint, this one identifies contacts by yourexternalUserId
rather than the Vambe contact ID.
Use Cases
- User Profile Enrichment: Add user data from your system to webchat contacts
- Session Data: Store information about user sessions and interactions
- External System Sync: Sync user data from your database to Vambe
- Custom Tracking: Add custom tracking fields for webchat visitors
- User Identification: Link webchat conversations to your user IDs
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Request Body
Field | Type | Required | Description |
---|---|---|---|
externalUserId | string | Yes | Your unique identifier for the webchat user |
metadata | object | Yes | Key-value pairs of metadata to add/update |
External User ID: This must match the
externalUserId
you provided when
initializing the webchat widget or creating the contact.Response Structure
Returns the updated contact metadata.Example Request
Example Response
Common Use Cases
1. Add User Profile Data
2. Track Session Information
3. Sync from Your Database
Webchat External User ID
TheexternalUserId
is typically set when:
- Widget Initialization: Passed when initializing the webchat widget
- User Login: Set when user authenticates on your website
- Cookie/Session: Tracked via browser session or cookie
Metadata Processing
- Unstructured Data: Metadata is processed with AI
- Field Matching: Automatically maps to custom field definitions
- All Fields Updated: Uses
editAllFields: true
mode - Flexible Schema: Accept any key-value pairs
Error Responses
Status Code | Description |
---|---|
400 | Bad Request - Invalid metadata format |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Contact not found with that user ID |
500 | Internal Server Error - Something went wrong |
Important Notes
- Webchat Only: This endpoint only works for webchat contacts
- External User ID Required: Must match the ID used in webchat widget
- Contact Must Exist: The webchat contact must already exist
- Organization Scoped: Contact must belong to your organization
- AI Processing: Metadata is processed with AI for field extraction
For Other Channels
If you need to update metadata for contacts from other channels (WhatsApp, Instagram, etc.), use the general metadata endpoint: General Metadata Endpoint:Related Endpoints
- POST /api/public/contact//update-metadata - General metadata update (all channels)
- GET /api/public/contact//info - Get contact info including metadata
- POST /api/public/customer/upsert/info - Create/update contacts with metadata
Webchat vs General Metadata
Feature | Webchat Metadata (This) | General Metadata |
---|---|---|
Identifier | externalUserId (your ID) | aiContactId (Vambe UUID) |
Channel | Webchat only | All channels |
Use When | Have external user ID | Have Vambe contact ID |
Widget Integration | ✅ Perfect for widgets | ❌ Need contact ID lookup |
Headers
API key needed to authorize the request
Response
Message sent successfully.