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"]
}'
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"]
}'
curl -X DELETE https://api-message.nativehub.live/api/v1/contacts/cnt_abc123 \
-H "Authorization: Bearer YOUR_TOKEN"
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"}
]
}'
Conditions are JSON objects with:
| Field | Type | Description |
|---|
field | string | Contact field: name, phone, email, tags |
operator | string | equals, contains, starts_with, ends_with |
value | string/array | Value 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.