Create and Update Contacts
Create a contact
POST /v1/organization/contactsRequest body
| Field | Type | Required | Description |
|---|---|---|---|
number | string | ✓ | Contact phone number |
first_name | string | — | First name |
middle_name | string | — | Middle name |
last_name | string | — | Last name |
full_name | string | — | Full name |
email | string | — | |
tags | string[] | — | Contact tags |
segment_id | string | — | Segment ID |
attributes | object | — | Custom attributes key/value map |
cURL
curl -X POST https://api.bahasha.app/v1/organization/contacts \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"full_name": "Jane Doe",
"number": "+254700000000",
"email": "[email protected]",
"tags": ["vip", "newsletter"],
"segment_id": "67f12bb3882d745f33f3d300",
"attributes": {
"city": "Nairobi",
"customer_tier": "Gold"
}
}'Update a contact
PATCH /v1/organization/contacts/:idSend only the fields you want to update.
curl -X PATCH https://api.bahasha.app/v1/organization/contacts/68011f5f8f7f109de8f62f5e \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"tags": ["vip", "new_segment"],
"attributes": {
"city": "Mombasa",
"customer_tier": "Platinum"
}
}'To remove a contact from its segment, send "segment_id": null.