Skip to main content
POST
Add metadata for a webchat contact
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 your externalUserId 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

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

The externalUserId is typically set when:
  1. Widget Initialization: Passed when initializing the webchat widget
  2. User Login: Set when user authenticates on your website
  3. Cookie/Session: Tracked via browser session or cookie
Example webchat initialization:

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

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:
View Documentation

Webchat vs General Metadata

Headers

x-api-key
string
required

API key needed to authorize the request

Body

application/json
metadata
object
externalUserId
string

Response

Message sent successfully.