Get started

    API Endpoint
        
https://base_url/api

The XeroChat API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, common HTTP verbs and uses API key based authentication.

To use this API, you need an API key. To get your own API key, please click on the profile picture on the top-right-side on your dashboard and then click on the API Key menu.

Note: Endpoints that have marked (Admin) have to be admin user to make a call to them.

Get User

                
curl -X GET 'https://base_url/api/get_user_info/?api_key=api_key&user_id=user_id'
                
            

To get user info you need to make a GET call to the following endpoint:
/get_user_info


                
Success Result Example:

{
    "status": "success",
    "user_info": {
        "id": "39",
        "name": "test_username",
        "email": "test_user@test.com",
        "mobile": "01234567891",
        "address": "Heaven 21",
        "user_type": "Member",
        "status": "1",
        "add_date": "2020-09-27 08:13:01",
        "last_login_at": "0000-00-00 00:00:00",
        "expired_date": "2020-10-27 00:00:00",
        "package_id": "16",
        "last_login_ip": "127.0.0.1"
    }
}

Error Result Example:

{
    "status": "error",
    "message": "No Matching User Found"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
user_id Integer The ID of the user
email String The email address of the user

Use either user_id or email address to make a successful get-user-info API call

Create User

                
curl -X POST \
'https://base_url/api/create_system_user' \
-d 'api_key=your_api_key' \
-d 'name=name' \
-d 'email=email' \
-d 'password=password' \
-d 'package_id=package_id' \
-d 'expired_date=expired_date'
                
            

To create a new user you need to make a POST call to the following endpoint:
/create_system_user


                
Success Result example :

{ 
    "status": "success",
    "id": 29
}

Error Result Example:

{
    "status": "error",
    "message": "Email already exists"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key.
name String Name of the user
email String Email of the user
password String Password of the user. We recommend use a combination of alpha-numeric characters including special characters.
package_id Integer Package ID of the system
expired_date String Expire Date in YYYY-MM-DD Format
mobile Numeric (optional) Mobile number of the user
address String (optional) Address of the user

Update User

                
curl -X POST \
'https://base_url/api/update_user/{userId}' \
-d 'api_key=api_key' \
-d 'name=name' \
-d 'mobile=mobile' \
-d 'address=address' \
-d 'package_id=package_id' \
-d 'expired_date=expired_date' 
                
            

To update a user you need to make a POST call to the following endpoint:
/create_system_user/{userId}


                
Success Result Example:

{
    "status": "success"
}

Error Result Example:

{
    "status": "error",
    "message": "User not found with the ID: 12"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
name String (optional) The user's name to be updated
mobile Numeric (optional) The user's mobile number to be updated
address String (optional) The user's address number to be updated
package_id Integer (optional) The package_id to be updated
expired_date Date (optional) The expired_date of the user's validity to be updated:
Date Format: 'YYYY-MM-DD'

You need to provide at least one more parameter with the api_key to make a successful update-user API call

Get Packages

                
curl -X GET 'https://base_url/api/get_all_packages/?api_key=api_key'
                
            

To get info of all pacakges, you need to make a GET call to the following endpoint:
/get_all_packages


                
Success Result Example:

{
    "status": "success",
    "packages": [
        {
            "id": "1",
            "package_name": "Trial",
            "module_ids": "251,80,79,263,65, ...",
            "price": "0",
            "validity": "0",
            "deleted": "0",
            "visible": "0",
            "highlight": "0"
        },
        {
            "id": "16",
            "package_name": "everything",
            "module_ids": "251,80,202,201,88,206, ...",
            "price": "112.35",
            "validity": "700",
            "deleted": "0",
            "visible": "1",
            "highlight": "0"
        }

        // more
    ]
}

Error Result Example:

{
    "status": "error",
    "message": "Either API Key Invalid or Member Validity Expired"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key

Get Subscriber

                
curl -X GET 'https://base_url/api/subscriber_information/?api_key=api_key&subscriber_id=subscriber_id'
                
            

To get subscriber info, you need to make a GET call to the following endpoint:
/subscriber_information


                
Success Result Example:

{
    "status": "success",
    "subscriber_info": {
        "subscriber_id": "134242424",
        "labels": "",
        "first_name": "test_first_name",
        "last_name": "test_last_name",
        "full_name": "test_full_name",
        "gender": "",
        "locale": "",
        "timezone": "",
        "page_name": "XeroDevs",
        "page_id": "1123123123123",
        "unavailable": "0",
        "last_error_message": "",
        "last_error_message_conversation_broadcast": "",
        "refferer_source": "",
        "subscribed_at": "0000-00-00 00:00:00",
        "email": "test@test.com",
        "phone_number": "01234567891",
        "birthdate": "0000-00-00",
        "last_subscriber_interaction_time": "0000-00-00 00:00:00"
    }
}

Error Result Example:

{
    "status": "error",
    "message":" No Matching Subscriber Found"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
subscriber_id Integer Subscriber PSID

Get Labels

                
curl -X GET 'https://base_url/api/get_all_labels/?api_key=api_key&page_id=page_id'
                
            

To get all labels, you need to make a GET call to the following endpoint:
/get_all_labels


                
Success Result Example:

{
    "status": "success",
    "label_info":[
        {
            "label_id": "2472856209402188",
            "label_name": "Important"
        },
        {
            "label_id": "2328660457215897",
            "label_name": "Product"
        }
    ]
}

Error Result Example:

{
    "status": "error",
    "message": "No Matching Label Found"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
page_id Integer Page ID [must be bot enabled in the system]

Create Label

                
curl -X POST \ 
'https://base_url/api/create_label' \
-d 'api_key=api_key' \
-d 'label_name=label_name' \
-d 'page_id=page_id' 
                
            

To create a label, you need to make a POST call to the following endpoint:
/create_label


                
Success Result Example:

{
    "status": "success",
    "label_id": "012345678790"
}

Error Result Example:

{
    "status": "error",
    "message": "No Enabled Bot Found"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
label_name String Label name to be created
page_id Integer Page ID [must be bot enabled in the system]

Assign Label

                
curl -X POST \ 
'https://base_url/api/assign_label' \
-d 'api_key=api_key' \
-d 'label_ids=6243946525492645,9452768492754035' \
-d 'page_id=page_id' \
-d 'subscriber_id=subscriber_id'
                
            

To assign a label, you need to make a POST call to the following endpoint:
/assign_label


                
Success Result Example:

{
    "success": true,
    "status": "success"
}

Error Result Example:

{
    "status": "error",
    "message": "(#100) The user ID is not valid."
}

{
    "status": "error",
    "message": "No Enabled Bot Found"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
label_ids String Label ID to be assigned. You can provide multiple label IDs separated by comma
page_id Integer Page ID [must be bot enabled in the system]
subscriber_id Integer Subscriber PSID

Get Contact Group

                
curl -X GET 'https://base_url/api/get_contact_group/?api_key=api_key&contact_type_id=contact_type_id'
                
            

To get contact group, you need to make a GET call to the following endpoint:
/get_contact_group


                
Success Result Example:

{
    "id": "4567",
    "user_id": "345",
    "type": "Group 12",
    "created_at": "2020-10-28 13:40:46",
    "deleted": "0"
}

Error Result Example:

{
    "status": "error",
    "message": "The contact type ID is required"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
contact_type_id Integer The contact type ID to be fetched

Create Contact Group

                
curl -X POST \
'https://base_url/api/create_contact_group' \
-d 'api_key=api_key' \
-d 'name=name' 
                
            

To create contact group, you need to make a POST call to the following endpoint:
/create_contact_group


                
Success Result Example:

{
    "status": "success",
    "contact_type_id": 276
}

Error Result Example:

{
    "status": "error",
    "message": "The contact type name is required"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
name String The name of contact group to be created

Update Contact Group

                
curl -X POST \
'https://base_url/api/update_contact_group/{contact_type_id}' \
-d 'api_key=api_key' \
-d 'name=name' 
                
            

To update contact group, you need to make a POST call to the following endpoint:
/update_contact_group/{contact_type_id}


                
Success Result Example:

{
    "status": "success"
}

Error Result Example:

{
    "status": "error",
    "message": "The contact type name is required"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
name String The name of the contact group to be updated

Delete Contact Group

                
curl -X POST \
'https://base_url/api/delete_contact_group' \
-d 'api_key=api_key' \
-d 'contact_type_id=contact_type_id'
                
            

To delete contact group, you need to make a POST call to the following endpoint:
/delete_contact_group


                
Success Result Example:

{
    "status": "success",
    "message": "The contact type ID (2) has been deleted"
}

Error Result Example:

{
    "status": "error",
    "message": "The contact_type_id field is required"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
contact_type_id Integer The contact type ID to be deleted

Get Contact

                
curl -X GET 'https://base_url/api/get_contact/?api_key=api_key&contact_id=contact_id'
                
            

To get contact, you need to make a GET call to the following endpoint:
/get_contact


                
Success Result Example:

{
    "id": "233",
    "user_id": "87",
    "contact_type_id": "67",
    "first_name": "test_first_name",
    "last_name": "test_last_name",
    "phone_number": "01234567891",
    "email": "test@test.com",
    "notes": "",
    "unsubscribed": "0",
    "deleted": "0"
}

Error Result Example:

{
    "status": "error",
    "message": "The contact ID does not exist"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
contact_id Integer The contact ID to be fetched

Create Contact

                
curl -X POST \
'https://base_url/api/create_contact' \
-d 'api_key=api_key' \
-d 'contact_type_id=contact_type_id' \
-d 'email=email' \
-d 'phone_number=phone_number' \
-d 'first_name=first_name' \
-d 'last_name=last_name' 
                
            

To create contact, you need to make a POST call to the following endpoint:
/create_contact


                
Success Result Example:

{
    "status": "success",
    "new_contact_id": 45
}

Error Result Example:

{
    "status": "error",
    "message": "The email or phone_number is required"
}

{
    "status": "error",
    "message": "The contact ID does not exist"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
contact_type_id Integer The contact type ID to be attached to
email String The email address of the user
phone_number String The phone number of the user
first_name String (optional) The first name of the user
last_name String (optional) The last name of the user

Note: Either email or phone_number is required

Update Contact

                
curl -X POST \
'https://base_url/api/update_contact/{contact_id}' \
-d 'api_key=api_key' \
-d 'email=email' \
-d 'phone_number=phone_number' \
-d 'first_name=first_name' \
-d 'last_name=last_name' 
                
            

To update contact, you need to make a POST call to the following endpoint :
/update_contact/{contact_id}


                
Success Result Example:

{
    "status": "success"
}

Error Result Example:

{
    "status": "error",
    "message": "You should at least provide value for first name or last name or email or phone number"
}

{
    "status": "error",
    "message": "The contact ID does not exist"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
contact_id Integer The contact ID to be updated for
email String (optional) The email address of the user
phone_number String (optional) The phone number of the user
first_name String (optional) The first name of the user
last_name String (optional) The last name of the user

Note: You can update first_name or last_name. You can update email or phone_number if they have not been added previously.

Delete Contact

                
curl -X POST \
'https://base_url/api/delete_contact' \
-d 'api_key=api_key' \
-d 'contact_id=contact_id' 
                
            

To delete contact, you need to make a POST call to the following endpoint:
/delete_contact


                
Success Result Example:

{
    "status": "success",
    "message": "The contact ID (3) has been deleted"
}

Error Result Example:

{
    "status": "error",
    "message": "The contact ID does not exist"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
contact_id Integer The contact ID to be deleted

Get Flow Campaign List

                
curl -X GET 'https://base_url/api/get_flow_campaigns/?api_key=api_key                
            

To get flow campaign list, you need to make a GET call to the following endpoint:
/get_flow_campaigns


                
Success Result Example:

[
    {
        "id": "1",
        "flow_name": "Flow Campaign 1"
    },
    {
        "id": "2",
        "flow_name": "Flow Campaign 2"
    },
    {
        "id": "3",
        "flow_name": "Flow Campaign 3"
    },
    {
        "id": "6",
        "flow_name": "Flow Campaign 4"
    }
]
                
            

PARAMETERS

Field Type Description
api_key String Your API key

Get FLow Campaign Info

                
curl -X POST 'https://base_url/api/get_flow_campaign_info/?api_key=api_key&flow_campaign_id=flow_campaign_id'
                
            

To get flow campaign info, you need to make a GET call to the following endpoint:
/get_flow_campaign_info


                
Success Result Example:

{
    "id": "1",
    "flow_name": "serial check",
    "questions": [
        "What do you like to do?",
        "What is your favorite pet?",
        "What is your favorite color?",
        "Who is your favorite author?",
        "Which country do you love to live in?"
    ]
}

Error Result Example:

{
    "status": "error",
    "message": "The flow_campaign_id field is required"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
flow_campaign_id Integer The ID of the flow campaign

Get Single Subscriber Flow Info

                
curl -X GET 'https://base_url/api/get_single_subscriber_flow_info/?api_key=api_key&flow_campaign_id=flow_campaign_id&subscriber_id=subscriber_id'
                
            

To get single subscriber flow info, you need to make a GET call to the following endpoint:
/get_single_subscriber_flow_info


                
Success Result Example:

{
    "id": "1",
    "flow_name": "Flow Campaign 1",
    "data": [
        {
            "question_id": "45",
            "question": "What do you like to do?",
            "answer": "Reading, Traveling, Watching Movies"
        },
        {
            "question_id": "46",
            "question": "What is your favorite pet?",
            "answer": "Dog"
        },
        {
            "question_id": "47",
            "question": "What is your favorite color?",
            "answer": "Black"
        },
        {
            "question_id": "48",
            "question": "Who is your favorite author?",
            "answer": "Sigmund Freud"
        },
        {
            "question_id": "49",
            "question": "Which country do you love to live in?",
            "answer": "France"
        }
    ]
}

Error Result Example:

{
    "status": "error",
    "message": "The flow campaign ID does not exist"
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
flow_campaign_id Integer The ID of the flow campaign
subscriber_id Integer The ID of the flow campaign subscriber

Get All Subscribers Flow Info

                
curl -X GET 'https://base_url/api/get_all_subscriber_flow_info/?api_key=api_key&flow_campaign_id=flow_campaign_id'
                
            

To get all subscribers flow info, you need to make a GET call to the following endpoint:
/get_all_subscriber_flow_info


                
Success Result Example:

{
    "id": "1",
    "flow_name": "serial check",
    "data": {
        "2499454673490220": [
            {
                "question_id": "45",
                "question": "What do you like to do?",
                "answer": "Reading, Traveling, Watching Movies"
            },
            {
                "question_id": "46",
                "question": "What is your favorite pet?",
                "answer": "Dog"
            },
            {
                "question_id": "47",
                "question": "What is your favorite color?",
                "answer": "Black"
            },
            {
                "question_id": "48",
                "question": "Who is your favorite author?",
                "answer": "Sigmund Freud"
            },
            {
                "question_id": "49",
                "question": "Which country do you love to live in?",
                "answer": "France"
            }
        ],
        "3001440154747507": [
            {
                "question_id": "45",
                "question": "What do you like to do?",
                "answer": "Traveling, Watching Movies"
            },
            {
                "question_id": "46",
                "question": "What is your favorite pet?",
                "answer": "Cat"
            },
            {
                "question_id": "47",
                "question": "What is your favorite color?",
                "answer": "Blue"
            },
            {
                "question_id": "48",
                "question": "Who is your favorite author?",
                "answer": "William Shakespeare"
            },
            {
                "question_id": "49",
                "question": "Which country do you love to live in?",
                "answer": "Germany"
            }
        ]
    }
}
                
            

PARAMETERS

Field Type Description
api_key String Your API key
flow_campaign_id Integer The ID of the flow campaign