Create Contact
Add a new contact with all details
Reading time: 1 minute
Create Contact
Add a new contact with all details.
POST
{{base_url}}/contactsQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
phone_number_id | string | Yes | Phone number ID of the sender |
Request Body (form-data)
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
name | string | Yes | Contact name | - |
phone | string | Yes | Phone number in international format (96650000000) | - |
email | string | No | Email address | - |
branch_id | string | No | Branch ID | - |
contact_group_id | string | No | Contact group ID | - |
description | string | No | Contact description | - |
address | string | No | Full address | - |
full_name | string | No | Full name | - |
is_favorite | boolean | No | Mark as favorite contact | false |
file | file | No | Avatar image (JPG, PNG - max 5MB) | - |
avatar | string | No | Avatar image URL | - |
Phone Number Requirements:
- Must be in international format (96650000000)
- No special characters (+ or -)
- Starts with country code
Example Request
Example Requestbash
curl -X POST "{{base_url}}/contacts?phone_number_id=123456" \
-H "Accept: application/json" \
-H "X-Awal-Signature-256: sha256=abc..." \
-H "X-Timestamp: 1704124800" \
-H "X-Domain: your-workspace" \
-H "X-Client-ID: your-client-id" \
-F "name=Ahmed Mohammed" \
-F "phone=96650000000" \
-F "email=ahmed@example.com" \
-F "contact_group_id=1" \
-F "is_favorite=true" \
-F "file=@/path/to/avatar.jpg"Example Response
Response201 Created
{
"status": true,
"message": "Contact created successfully",
"data": {
"id": 1,
"name": "Ahmed Mohammed",
"phone": "96650000000",
"email": "ahmed@example.com",
"contact_group_id": 1,
"is_favorite": true,
"avatar": "https://storage.awalchat.com/contacts/1/avatar.jpg",
"created_at": "2024-01-15T10:30:00Z"
}
}Related
ā Back to Contacts
View Guide