Skip to main content

Contact Management

Create Contact

curl -X POST https://api-message.nativehub.live/api/v1/contacts \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+1234567890",
    "name": "John Doe",
    "email": "[email protected]",
    "tags": ["premium", "active"]
  }'

Update Contact

curl -X PUT https://api-message.nativehub.live/api/v1/contacts/cnt_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": ["premium", "vip"]
  }'

Delete Contact

curl -X DELETE https://api-message.nativehub.live/api/v1/contacts/cnt_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN"

Importing Contacts

CSV Format

phone,name,email,tags
+1234567890,John Doe,[email protected],"premium,active"
+9876543210,Jane Smith,[email protected],basic

Upload CSV

curl -X POST https://api-message.nativehub.live/api/v1/contacts/import \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "[email protected]"
Response:
{
  "imported": 1250,
  "failed": 3,
  "duplicates": 47,
  "errors": [
    {"row": 15, "reason": "Invalid phone format"}
  ]
}

Bulk Delete

curl -X POST https://api-message.nativehub.live/api/v1/contacts/bulk-delete \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "contact_ids": ["cnt_abc123", "cnt_xyz789"]
  }'

Segments

Segments dynamically group contacts based on conditions.

Create Segment

curl -X POST https://api-message.nativehub.live/api/v1/segments \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Customers",
    "conditions": [
      {"field": "tags", "operator": "contains", "value": "premium"}
    ]
  }'

Segment Conditions Format

Conditions are JSON objects with:
FieldTypeDescription
fieldstringContact field: name, phone, email, tags
operatorstringequals, contains, starts_with, ends_with
valuestring/arrayValue to match

Multiple Conditions

curl -X POST https://api-message.nativehub.live/api/v1/segments \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Active Premium Users",
    "conditions": [
      {"field": "tags", "operator": "contains", "value": "premium"},
      {"field": "tags", "operator": "contains", "value": "active"}
    ]
  }'
Multiple conditions use AND logic. All conditions must match.

Using Segments for Campaigns

curl -X POST https://api-message.nativehub.live/api/v1/campaigns \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Offer",
    "template_id": "tmpl_abc123",
    "segment_id": "seg_xyz789"
  }'
Segments auto-update. New contacts matching conditions are included in future sends.