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

All Contacts requests use the following request headers and authentication format.
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

Response FROM Sozuri Get SIngle Contact API (synchronous)

The body of all the message response will be a JSON object containing the following fields:
{
    "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:
  • id: Integer
  • fname First Name: String (nullable)
  • mname Middle Name : String (nullable)
  • lname (Last Name): String (nullable)
  • mobile: String
  • email: String (nullable)
  • city: String (nullable)
  • company: String (nullable)
  • created_at: Datetime
pagination Object Pagination details for the contacts list:
  • current_page: Integer (Current page number)
  • data: Array (Array of contacts data)
  • first_page_url: String (URL of the first page)
  • from: Integer (Start index of the current page)
  • last_page: Integer (Total number of pages)
  • last_page_url: String (URL of the last page)
  • links: Array (Array of pagination links)
  • next_page_url: String (URL of the next page)
  • path: String (Base path of the endpoint)
  • per_page: Integer (Number of contacts per page)
  • prev_page_url: String (URL of the previous page)
  • to: Integer (End index of the current page)
  • total: Integer (Total number of contacts)

Get Contact Request TO the Sozuri Contacts API

SINGLE Contact requests use the following request headers and authentication format.

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": "[email protected]",
        "city": "sms",
        "company": "Sozu PLC",
        "created_at": "2024-03-26T16:32:44.000000Z"
    }
}

CREATE Contact Request TO the Sozuri Contacts API

Contact create requests use the following request headers and authentication format.

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": "[email protected]"
        },
        {
            "fname": "Lucy",
            "mname": "",
            "lname": "Susan",
            "mobile": "25472516429x",
            "city": "Kitui",
            "company": "Ivy Ltd.",
            "email": "[email protected]"
        }
    ]
}

JSON Response


{
    "message": "Contacts created successfully"
}

UPDATE Contact Request TO the Sozuri Contacts API

Contact update requests use the following request headers and authentication format.

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": "[email protected]"
    }
}

JSON Response


{
    "message": "Contact updated successfully"
}

DELETE Contact Request TO the Sozuri Contacts API

Contact delete requests use the following request headers and authentication format.

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"
}