Skip to main content
POST
Open a new ticket for web whatsapp

Overview

Create a new support ticket for a WhatsApp Web (QR) contact. This endpoint initializes a conversation in a specific pipeline stage, optionally sends an initial message, and allows you to set custom metadata for both the contact and ticket. This is ideal for programmatically creating tickets when a customer takes a specific action on your platform (e.g., form submission, purchase, support request).

Use Cases

  • Form-triggered Tickets: Create a ticket when a user submits a contact form
  • E-commerce Integration: Open tickets for new orders or delivery issues
  • Onboarding Workflows: Start onboarding tickets for new customers
  • Support Escalation: Programmatically create tickets from other systems
  • Event-based Tickets: Create tickets based on user behavior or triggers
  • CRM Synchronization: Sync customer issues from external CRM to Vambe

Authentication

This endpoint requires authentication using an API key. Include your API key in the request header:

Path Parameters

Request Body

Message Object

When providing an initial message, use this structure:

Response Structure

The endpoint returns a success response with the created contact information:

Example Request

Example Response

Common Use Cases

1. Create Ticket from Contact Form

2. E-commerce Order Ticket

3. Support Escalation

4. Create Ticket Without Initial Message

5. Using Smart Templates

Phone Number Format

The to_phone_number field accepts phone numbers in various formats:
  • With country code: "+56912345678" (recommended)
  • String format: "56912345678"
  • Number format: 56912345678
The system automatically strips non-numeric characters and validates the number.

Metadata Best Practices

Contact Metadata

Store information about the person:
  • Company name
  • Industry
  • Customer tier/plan
  • Account creation date
  • Language preference
  • Time zone

Ticket Metadata

Store information about this specific ticket:
  • Issue type/category
  • Priority level
  • Related order/transaction IDs
  • Urgency
  • Source (web, mobile, API, etc.)
  • Custom fields specific to your workflow

Error Responses

Important Notes

  • Phone ID Requirement: The phoneId in the path must be a WhatsApp Web connection that you’ve set up via QR code
  • Stage ID: Make sure the stage_id exists in your pipelines - use the GET /api/public/pipeline endpoint to get valid stage IDs
  • Duplicate Contacts: If a contact with the same phone number already exists, the ticket will be created for that existing contact
  • Metadata Flexibility: Both contact_metadata and ticket_metadata accept any key-value pairs as objects
  • AI Processing: When you don’t provide a message, the AI assistant will automatically engage based on your pipeline configuration
  • Message vs Template: You can provide either plain content or use a templateId with variables

What Happens After Creation

  1. Contact Creation/Update: The system finds or creates a contact with the provided phone number
  2. Metadata Processing: Contact and ticket metadata are processed and stored
  3. Stage Assignment: The ticket is placed in the specified pipeline stage
  4. Message Sending (if provided):
    • If message.content is provided without templateId: Sends a plain text message
    • If message.templateId is provided: Sends a smart template with variables
    • If no message: AI assistant takes over based on pipeline configuration
  5. Contact ID Return: You receive the aiContactId to track this contact for future operations

Headers

x-api-key
string
required

API key needed to authorize the request

Path Parameters

phoneId
string
required

Body

application/json
to_phone_number
required
Required range: x >= 1
stage_id
string
required
contact_name
string
contact_metadata
object
ticket_metadata
object
integration_data
object
email
string<email>
Pattern: ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
message
object

Response

200

Ticket created successfully