Contact Groups API

CONTACT GROUPS APISendiva SMS Contact Groups API allows you to manage contact groups that are identified by a unique random ID. Use this ID to create, view, update or delete groups.

API Endpoint

Markup

https://sms.andiva.co.ke/api/v3/contacts

Parameters

PARAMETER REQUIRED DESCRIPTION
Authorization YES When calling our API, send your api token with the authentication type set as Bearer (Example: Authorization: Bearer {api_token})
Accept YES Set to application/json

Create a group

Creates a new group object. Sendiva SMS returns the created group object with each request.

API Endpoint

Markup

https://sms.andiva.co.ke/api/v3/contacts

Parameters

PARAMETER REQUIRED TYPE DESCRIPTION
name YES string The name of the group

Example request

PHP

curl -X POST https://sms.andiva.co.ke/api/v3/contacts \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"name":"Codeglen"}'

Returns

Returns a contact object if the request was successful.

JSON

{
    "status": "success",
    "data": "group data with all details",
}

If the request failed, an error object will be returned.

JSON

{
    "status": "error",
    "message" : "A human-readable description of the error."
}

View a group

Retrieves the information of an existing group. You only need to supply the unique group ID that was returned upon creation or receiving.

API Endpoint

Markup

https://sms.andiva.co.ke/api/v3/contacts/{group_id}/show/

Parameters

PARAMETER REQUIRED TYPE DESCRIPTION
group_id YES string Contact Groups uid

Example request

PHP

curl -X POST https://sms.andiva.co.ke/api/v3/contacts/6065ecdc9184a/show \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \

Returns

Returns a contact object if the request was successful.

JSON

{
    "status": "success",
    "data": "group data with all details",
}

If the request failed, an error object will be returned.

JSON

{
    "status": "error",
    "message" : "A human-readable description of the error."
}

Update a group

Updates an existing group. You only need to supply the unique ID that was returned upon creation.

API Endpoint

Markup

https://sms.andiva.co.ke/api/v3/contacts/{group_id}

Parameters

PARAMETER REQUIRED TYPE DESCRIPTION
group_id YES string Contact Groups uid
name YES string New group name

Example request

PHP

curl -X PATCH https://sms.andiva.co.ke/api/v3/contacts/6065ecdc9184a \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"name":"Codeglen Update"}'

Returns

Returns a contact object if the request was successful.

JSON

{
    "status": "success",
    "data": "groups data with all details",
}

If the request failed, an error object will be returned.

JSON

{
    "status": "error",
    "message" : "A human-readable description of the error."
}

Delete a group

Deletes an existing group. You only need to supply the unique id that was returned upon creation.

API Endpoint

Markup

https://sms.andiva.co.ke/api/v3/contacts/{group_id}

Parameters

PARAMETER REQUIRED TYPE DESCRIPTION
group_id YES string Contact Groups uid

Example request

PHP

curl -X DELETE https://sms.andiva.co.ke/api/v3/contacts/6065ecdc9184a \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \

Returns

Returns a contact object if the request was successful.

JSON

{
    "status": "success",
    "data": "null",
}

If the request failed, an error object will be returned.

JSON

{
    "status": "error",
    "message" : "A human-readable description of the error."
}

View all groups

API Endpoint

Markup

https://sms.andiva.co.ke/api/v3/contacts/

Example request

PHP

curl -X GET https://sms.andiva.co.ke/api/v3/contacts \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \

Returns

Returns a contact object if the request was successful.

JSON

{
    "status": "success",
    "data": "group data with pagination",
}

If the request failed, an error object will be returned.

JSON

{
    "status": "error",
    "message" : "A human-readable description of the error."
}

Powered by BetterDocs

Leave a comment