Documentation
HTTP Contacts API
OPENSMS Contacts API helps you manage contacts that are identified by a unique random ID. Using this ID, you can create, view, update, or delete contacts. This API works as a collection of customer-specific contacts that allows you to group them and assign custom values that you can later use when sending SMS template messages.
The Contacts API uses HTTP verbs and a RESTful endpoint structure with an access key that is used as the API Authorization. Request and response payloads are formatted as JSON using UTF-8 encoding and URL encoded values.
API Endpoint
https://www.opensms.co.ke/api/http/contacts
| Parameter | Required | Description |
|---|---|---|
| api_token |
Yes
|
API Token From Developers option. Get API Token |
| Accept |
Yes
|
Set to application/json |
| Content-Type |
Yes
|
Set to application/json |
Creates a new contact object. OPENSMS returns the created contact object with each request.
API Endpoint
https://www.opensms.co.ke/api/http/contacts/{group_id}/store
| Parameter | Required | Type | Description |
|---|---|---|---|
| group_id |
Yes
|
string | Contact Groups uid |
| PHONE |
Yes
|
number | The phone number of the contact. |
| OTHER_FIELDS |
No
|
string | All Contact's other fields: FIRST_NAME (?), LAST_NAME (?),... (depending on the contact group fields configuration) |
curl -X POST https://www.opensms.co.ke/api/http/contacts/6065ecdc9184a/store \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"api_token":"YOUR_API_KEY",
"PHONE":"8801721970168",
"FIRST_NAME":"Jhon",
"LAST_NAME":"Doe",
}'
Returns a contact object if the request was successful.
{
"status": "success",
"data": "contacts data with all details",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
Retrieves the information of an existing contact. You only need to supply the unique contact uid and group uid that was returned upon creation or receiving.
API Endpoint
https://www.opensms.co.ke/api/http/contacts/{group_id}/search/{uid}
| Parameter | Required | Type | Description |
|---|---|---|---|
| group_id |
Yes
|
string | Contact Groups uid |
| uid |
Yes
|
string | Contact uid |
curl -X POST https://www.opensms.co.ke/api/http/contacts/6065ecdc9184a/search/606732aec8705 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"api_token":"YOUR_API_KEY"}'
Returns a contact object if the request was successful.
{
"status": "success",
"data": "contacts data with all details",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
Updates an existing contact. You only need to supply the unique uid of contact and contact group uid that was returned upon creation.
API Endpoint
https://www.opensms.co.ke/api/http/contacts/{group_id}/update/{uid}
| Parameter | Required | Type | Description |
|---|---|---|---|
| group_id |
Yes
|
string | Contact Groups uid |
| uid |
Yes
|
string | Contact uid |
| PHONE |
Yes
|
number | The phone number of the contact. |
| OTHER_FIELDS |
No
|
string | All Contact's other fields: FIRST_NAME (?), LAST_NAME (?),... (depending on the contact group fields configuration) |
curl -X PATCH https://www.opensms.co.ke/api/http/contacts/6065ecdc9184a/update/606732aec8705 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"api_token":"YOUR_API_KEY",
"PHONE":"8801721970168",
"FIRST_NAME":"Jhon",
"LAST_NAME":"Doe",
}'
Returns a contact object if the request was successful.
{
"status": "success",
"data": "contacts data with all details",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
Deletes an existing contact. You only need to supply the unique contact uid and group uid that was returned upon creation.
API Endpoint
https://www.opensms.co.ke/api/http/contacts/{group_id}/delete/{uid}
| Parameter | Required | Type | Description |
|---|---|---|---|
| group_id |
Yes
|
string | Contact Groups uid |
| uid |
Yes
|
string | Contact uid |
curl -X DELETE https://www.opensms.co.ke/api/http/contacts/6065ecdc9184a/delete/606732aec8705 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"api_token":"YOUR_API_KEY"}'
Returns a contact object if the request was successful.
{
"status": "success",
"data": "contacts data with all details",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://www.opensms.co.ke/api/http/contacts/{group_id}/all
| Parameter | Required | Type | Description |
|---|---|---|---|
| group_id |
Yes
|
string | Contact Groups uid |
curl -X POST https://www.opensms.co.ke/api/http/contacts/6065ecdc9184a/all \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"api_token":"YOUR_API_KEY"}'
Returns a contact object if the request was successful.
{
"status": "success",
"data": "contacts data with pagination",
}
If the request failed, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}