Create tags for a contact
Channels Management
Create tags for a contact
Creates tags for the contact for the specified channel. TICKET-type tags are only assigned when the contact has an active ticket. The response reports counts for created, assigned, and not-assigned tags, plus details explaining why some could not be assigned.
POST
Create tags for a contact
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
Request Body
Response Structure
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
Platform Identifier Formatting
The endpoint automatically cleans the platform identifier:- Removes
+symbols - Removes spaces
- Normalizes the format
+5691234567856912345678+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
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
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 platform identifier for the contact, e.g. phone number (with country code) or username
The type of channel to create a tag for
Available options:
whatsapp, playground, web-whatsapp, instagram Body
application/json
Response
Tags processed successfully
