Overview
Create and assign tags to a contact using their channel information (phone number or username) instead of contact ID. This endpoint is perfect when you know the contact’s phone/username but not their Vambe contact ID. The endpoint automatically creates tags that don’t exist and intelligently handles TICKET-type tags (only assigned when the contact has an active ticket).Use Cases
- Webhook Integration: Tag contacts from external webhooks using phone numbers
- Form Submissions: Tag contacts from web forms without looking up their ID
- CSV Imports: Bulk tag contacts using phone numbers from spreadsheets
- E-commerce Events: Tag customers after purchases using their phone
- Marketing Automation: Auto-tag contacts from campaign responses
- Support Tickets: Tag customers when tickets are created in external systems
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
channelType | string | Yes | Channel type: “whatsapp”, “web-whatsapp”, “instagram”, “playground” |
platformIdentifier | string | Yes | Phone number (with country code) or username |
Request Body
Field | Type | Required | Description |
---|---|---|---|
tags | string[] | Yes | Array of tag names (strings) to create/assign |
Response Structure
Field | Type | Description |
---|---|---|
status | string | Status of the operation (always “success”) |
createdCount | number | Number of new tags created |
assignedCount | number | Number of tags successfully assigned to the contact |
notAssignedCount | number | Number of tags that couldn’t be assigned |
notAssignedTags | string[] | Names of tags that weren’t assigned |
details | string | Explanation of why some tags weren’t assigned (if any) |
Example Request
Example Response
Example Response with Ticket Tags
When a contact has no active ticket and you try to assign TICKET-type tags:Common Use Cases
1. Tag Contact from Webhook
2. Tag Customer After Purchase
3. Tag from Form Submission
4. Bulk Tag from CSV
5. Tag Instagram Contact
6. Campaign Response Tagging
Channel Types
Channel Type | Platform Identifier Format | Example |
---|---|---|
whatsapp | Phone with country code | +56912345678 |
web-whatsapp | Phone with country code | +56912345678 |
instagram | Username (no @) | customer_username |
playground | Phone or identifier | +56912345678 |
Platform Identifier Formatting
The endpoint automatically cleans the platform identifier:- Removes
+
symbols - Removes spaces
- Normalizes the format
+56912345678
56912345678
+569 1234 5678
Tag Creation Behavior
Automatic Tag Creation
If a tag doesn’t exist, it will be automatically created for your organization: Request:{ "tags": ["new-tag-2024"] }
- System checks if tag “new-tag-2024” exists
- If not, creates it
- Assigns it to the contact
- Returns
createdCount: 1
Tag Assignment
- CONTACT Tags: Always assigned to the contact
- TICKET Tags: Only assigned if contact has an active ticket
Response Breakdown
Example Scenario:- Request tags:
["customer", "vip", "urgent-ticket"]
- “customer” and “vip” exist as CONTACT tags
- “urgent-ticket” exists as a TICKET tag
- Contact has NO active ticket
Error Responses
Status Code | Description |
---|---|
400 | Bad Request - Invalid channel type or missing tags |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Contact not found for the specified channel/identifier |
500 | Internal Server Error - Something went wrong |
Important Notes
- Auto-Create: Tags are automatically created if they don’t exist
- Additive Operation: This endpoint adds tags, it doesn’t replace existing ones
- Case Sensitive: Tag names are case-sensitive
- Duplicates: Duplicate tags in the array won’t create duplicate assignments
- Contact Lookup: Contact must exist with the specified platform identifier
- Phone Format: Phone numbers should include country code (e.g., +56 for Chile)
Differences from PATCH Endpoint
Feature | POST (This Endpoint) | PATCH (Update Tags) |
---|---|---|
Lookup Method | Phone/username | Contact ID (UUID) |
Tag Format | Tag names (strings) | Tag IDs (numbers) |
Behavior | Adds tags (additive) | Replaces all tags |
Tag Creation | Auto-creates missing tags | Requires existing tag IDs |
Response Detail | Created/assigned/not-assigned counts | Simple success + count |
Best Practices
1. Normalize Phone Numbers
2. Handle Ticket Tags Gracefully
3. Use Consistent Tag Naming
Related Endpoints
- GET /api/public/tags - Get all available tags and their IDs
- PATCH /api/public/contact/tags/ - Update tags using contact ID
- GET /api/public/contact//info - Get contact info including tags
- POST /api/public/ticket/open/web-whatsapp/ - Create ticket (enables TICKET tags)
Complete Workflow Example
Headers
API key for request authorization
Path Parameters
The type of channel to create a tag for
Available options:
whatsapp
, playground
, web-whatsapp
, instagram
The platform identifier for the contact, e.g. phone number (with country code) or username
Body
application/json
Response
Tags processed successfully