Sozuri Contacts API
Contacts API
For compatibility purposes, contacts API uses snake_case unlike the camelCase used in the rest of our omnichannel documentation.
You can use the Contacts API to Create, Update, Fetch Single, Fetch All, and Delete contacts:
All of these message types, except for reaction messages, can be designated as a
reply, which causes the delivered message to appear along with a contextual bubble
displaying the content of the message that you are replying to.
The base URL for Contacts API call is:
https://sozuri.net/api/v1/contacts
Request TO the Sozuri OmniChannel Contacts API
GET /api/v1/contacts Content-Type: application/json Authorization: Bearer Your_Project_API_KEY
GET CONTACTS.
{
"project": "Shopify",
"group": "Shopify Mpesa"
}
Parameter Name | Mandatory | Type | Description |
---|---|---|---|
project | Yes | String | The name of the project that owns the apiKey making this request. |
group | No | String | The Group name to fetch from,if not specified all contacts will be returned |
apiKey | - | String | The Project API Key. NB: Instead of having the apiKey in the body, it can alternatively be added as the Value of an Authorization header Bearer token instead. See its use in the Request header HERE |
GET Contacts Response parameters
Response FROM Sozuri Get SIngle Contact API (synchronous)
{ "group": "Shopify Mpesa", "contacts": { "current_page": 1, "data": [ { "id": 1, "fname": null, "mname": null, "lname": null, "mobile": "254725164293", "email": null, "city": null, "company": null, "created_at": "2024-03-21T07:06:37.000000Z" }, { "id": 2, "fname": null, "mname": null, "lname": null, "mobile": "254723364291", "email": null, "city": null, "company": null, "created_at": "2024-03-21T07:13:21.000000Z" }, { "id": 3, "fname": null, "mname": null, "lname": null, "mobile": "254723365291", "email": null, "city": null, "company": null, "created_at": "2024-03-21T07:23:53.000000Z" } ], "first_page_url": "http://localhost:8020/api/v1/contacts?page=1", "from": 1, "last_page": 1, "last_page_url": "http://localhost:8020/api/v1/contacts?page=1", "links": [ { "url": null, "label": "« Previous", "active": false }, { "url": "http://localhost:8020/api/v1/contacts?page=1", "label": "1", "active": true }, { "url": null, "label": "Next »", "active": false } ], "next_page_url": null, "path": "http://localhost:8020/api/v1/contacts", "per_page": 1000, "prev_page_url": null, "to": 3, "total": 3 } }
Parameter Name | Type | Description |
---|---|---|
group | String | The group name of the contacts, empty string if none was specified in the request |
contacts | Object | A JSON object with contacts data. Each contact has the following fields: |
|
||
pagination | Object | Pagination details for the contacts list: |
|
Get Contact Request TO the Sozuri Contacts API
Specify the contact ID or mobile number in the URL
GET /api/v1/contacts/456 Content-Type: application/json Authorization: Bearer Your_Project_API_KEY
GET Single Contact.
{
"project": "Shopify",
}
JSON Response
{
"contact": {
"id": 456,
"fname": "Suzan",
"mname": "Joy",
"lname": null,
"mobile": "254777222555",
"email": "lawren66@gmail.com",
"city": "sms",
"company": "Sozu PLC",
"created_at": "2024-03-26T16:32:44.000000Z"
}
}
CREATE Contact Request TO the Sozuri Contacts API
Specify the contact ID or mobile number in the URL
POST /api/v1/contacts Content-Type: application/json Authorization: Bearer Your_Project_API_KEY
POST Contacts.
{
"project": "Kalro",
"group": "shop-contacts",
"contacts": [
{
"fname": "Lawrence",
"mname": "Joel",
"lname": "",
"mobile": "25472516429x",
"city": "sms",
"company": "Sozu PLC",
"email": "lawl@m.m"
},
{
"fname": "Lucy",
"mname": "",
"lname": "Susan",
"mobile": "25472516429x",
"city": "Kitui",
"company": "Ivy Ltd.",
"email": "ivy@Ltd.com"
}
]
}
JSON Response
{
"message": "Contacts created successfully"
}
UPDATE Contact Request TO the Sozuri Contacts API
Specify the contact ID or mobile number in the URL
PUT /api/v1/contacts/456 Content-Type: application/json Authorization: Bearer Your_Project_API_KEY
GET Single Contact.
{
"project": "Shopify",
"group": "mpesa-contacts",
"contact": {
"fname": "Suzan",
"mname": "Joy",
"lname": "",
"mobile": "254777222555",
"city": "sms",
"company": "Sozu PLC",
"email": "lawren66@gmail.com"
}
}
JSON Response
{
"message": "Contact updated successfully"
}
DELETE Contact Request TO the Sozuri Contacts API
Specify the contact ID or mobile number in the URL
DELETE /api/v1/contacts/456 Content-Type: application/json Authorization: Bearer Your_Project_API_KEY
Delete Single Contact.
{
"project": "Shopify"
}
JSON Response
{
"message": "Contact deleted successfully"
}