NAV
bash javascript

Info

Welcome to the generated API reference. Get Postman Collection

Api management

APIs for managing user's chats

Websocket

[Example wss://api.app24.online:2233?instance=112233&token=k8jd78sd78jj33l598a64ee7510c]

Example request:

curl -X GET \
    -G "http://api-service.loc/websocket?instance=voluptate&token=quod" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/websocket"
);

let params = {
    "instance": "voluptate",
    "token": "quod",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

GET websocket

Query Parameters

Parameter Status Description
instance required The instance of the websocket.
token required The token of the websocket.

getToken

[Method for getting token in API service]

Example request:

curl -X PUT \
    "http://api-service.loc/token?email=earum&password=reiciendis&type=esse" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/token"
);

let params = {
    "email": "earum",
    "password": "reiciendis",
    "type": "esse",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "PUT",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "cabinet_user_id": 912,
    "access_token": "$2y$10$qeCKubxG.yPanuONchMMUe7M\/iQos6GcLXFk8gmmUfLzwPobQTP1C",
    "access_token_end_time": 1616071276,
    "refresh_token": "$2y$10$x8UgIewq3ckLrQi79z\/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO",
    "refresh_token_end_time": 1623760876
}

HTTP Request

PUT token

Query Parameters

Parameter Status Description
email required The email of the user. Example client@domain.com
password required The password of the user. Example Kioh7GHt6yg
type required The type of the request point, one of (direct, bitrix, amocrm). Example amocrm

checkToken


Requires authentication [The method returns actually information about both current tokens]

[Headers]

[Authentication: 2y$10$qeCKubxG.yPanuONchMMUe7M/iQos6GcLXFk8gmmUfLzwPobQTP1C4]

[Refresh: $2y$10$x8UgIewq3ckLrQi79z/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO]

Example request:

curl -X GET \
    -G "http://api-service.loc/me" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/me"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "cabinet_user_id": 912,
    "access_token": "$2y$10$qeCKubxG.yPanuONchMMUe7M\/iQos6GcLXFk8gmmUfLzwPobQTP1C",
    "access_token_end_time": 1616071276,
    "refresh_token": "$2y$10$x8UgIewq3ckLrQi79z\/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO",
    "refresh_token_end_time": 1623760876
}

Example response (403):

{
    "error": "Got an empty token"
}

HTTP Request

GET me

clientInstances


Requires authentication [The method shows a list of user instances]

[Headers]

[Authentication: 2y$10$qeCKubxG.yPanuONchMMUe7M/iQos6GcLXFk8gmmUfLzwPobQTP1C4]

[Refresh: $2y$10$x8UgIewq3ckLrQi79z/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO]

Example request:

curl -X GET \
    -G "http://api-service.loc/instances/1?userId=perspiciatis" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/instances/1"
);

let params = {
    "userId": "perspiciatis",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "instances": [
        "4433",
        "112233"
    ]
}

HTTP Request

GET instances/{userId}

Query Parameters

Parameter Status Description
userId required The ID of the cabinet user. Example 2331

checkPhone


Requires authentication [The method check user's phone on existing]

[Headers]

[Authentication: 2y$10$qeCKubxG.yPanuONchMMUe7M/iQos6GcLXFk8gmmUfLzwPobQTP1C4]

[Refresh: $2y$10$x8UgIewq3ckLrQi79z/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO]

Example request:

curl -X GET \
    -G "http://api-service.loc/user/1/instance/1/phone/1?userId=ipsum&phone=numquam" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/user/1/instance/1/phone/1"
);

let params = {
    "userId": "ipsum",
    "phone": "numquam",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "status": true
}

Example response (200):

{
    "status": false
}

HTTP Request

GET user/{userId}/instance/{instance}/phone/{phone}

Query Parameters

Parameter Status Description
userId required The ID of the cabinet user. Example 2331
phone required Phone for checking. Example 79220000001

Common

Response template

[Common response template for each method]

[tokens - (one time per day) This index add if access_token doesn't exists and need to generate again]

[data - This index content inside data of each method's response, and exists in all responses]

Example request:

curl -X GET \
    -G "http://api-service.loc/common-response" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/common-response"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "tokens": "access, refresh tokens with other information",
    "data": "some response data"
}

HTTP Request

GET common-response

Service settings

APIs for managing service settings

setLocale

[Method for setting a new application language]

Example request:

curl -X PUT \
    "http://api-service.loc/set-locale?locale=sed" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/set-locale"
);

let params = {
    "locale": "sed",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "PUT",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "locale": "ru"
}

HTTP Request

PUT set-locale

Query Parameters

Parameter Status Description
locale required A language for answers [en, ru] Default set en. Example ru

getLocale

[Method for getting current an application language]

Example request:

curl -X GET \
    -G "http://api-service.loc/get-locale" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/get-locale"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "locale": "en"
}

HTTP Request

GET get-locale

WhatsApp API

getDialogs


Requires authentication [The method shows a list of user dialogs]

[Headers]

[Authentication: 2y$10$qeCKubxG.yPanuONchMMUe7M/iQos6GcLXFk8gmmUfLzwPobQTP1C4]

[Refresh: $2y$10$x8UgIewq3ckLrQi79z/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO]

Example request:

curl -X GET \
    -G "http://api-service.loc/user/1/dialogs/1?userId=consectetur&instance=accusamus" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/user/1/dialogs/1"
);

let params = {
    "userId": "consectetur",
    "instance": "accusamus",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "dialogs": [
        {
            "id": "79220000001@c.us",
            "name": "+7 922 000-00-01",
            "image": "https:\/\/pps.whatsapp.net\/v\/t61.2000-24\/1.jpg",
            "metadata": {
                "isGroup": false,
                "participants": [],
                "groupInviteLink": null
            },
            "last_time": 1615455053,
            "unread_messages": 0
        },
        {
            "id": "79220000002@c.us",
            "name": "+7 922 000-00-02",
            "image": "https:\/\/pps.whatsapp.net\/v\/t61.24345\/3.jpg",
            "metadata": {
                "isGroup": false,
                "participants": [],
                "groupInviteLink": null
            },
            "last_time": 1615385847,
            "unread_messages": 0
        }
    ]
}

HTTP Request

GET user/{userId}/dialogs/{instance}

Query Parameters

Parameter Status Description
userId required The ID of a user of the cabinet ID user Example 2331
instance required The instance of a user. Example 334456

getMessages


Requires authentication [The method shows a list of user messages]

[Headers]

[Authentication: 2y$10$qeCKubxG.yPanuONchMMUe7M/iQos6GcLXFk8gmmUfLzwPobQTP1C4]

[Refresh: $2y$10$x8UgIewq3ckLrQi79z/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO]

Example request:

curl -X GET \
    -G "http://api-service.loc/user/1/instance/1/messages/1?userId=quod&instance=et&chatId=nobis" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/user/1/instance/1/messages/1"
);

let params = {
    "userId": "quod",
    "instance": "et",
    "chatId": "nobis",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "messages": [
        {
            "id": "true_79220000001@c.us_3EB021A49CD62FE77E43",
            "body": "тестовое сообщение в ватсапп",
            "fromMe": true,
            "self": 1,
            "isForwarded": 0,
            "author": "79020004444@c.us",
            "time": 1614676130,
            "chatId": "79220000001@c.us",
            "messageNumber": 5571,
            "type": "chat",
            "senderName": "Аналогик",
            "quotedMsgBody": null,
            "quotedMsgId": null,
            "quotedMsgType": null,
            "chatName": "+7 922 000-00-01",
            "status": {
                "sent": 1,
                "delivered": 1,
                "read": 1
            }
        },
        {
            "id": "true_79220000001@c.us_3EB024F5E103C57BBF0B",
            "body": "обратка связи",
            "fromMe": true,
            "self": 1,
            "isForwarded": 0,
            "author": "79020004444@c.us",
            "time": 1614677724,
            "chatId": "79220000001@c.us",
            "messageNumber": 5574,
            "type": "chat",
            "senderName": "Аналогик",
            "quotedMsgBody": null,
            "quotedMsgId": null,
            "quotedMsgType": null,
            "chatName": "+7 922 000-00-01",
            "status": {
                "sent": 1,
                "delivered": 1,
                "read": 1
            }
        }
    ],
    "lastMessageNumber": 5753
}

HTTP Request

GET user/{userId}/instance/{instance}/messages/{chatId}

Query Parameters

Parameter Status Description
userId required The ID of a user of the cabinet ID user Example 2331
instance required The instance of a user. Example 334456
chatId required The ID of a chat (phone@c.us). Example 79220000002@c.us"

sendMessages


Requires authentication [Message sending function]

[Headers]

[Authentication: 2y$10$qeCKubxG.yPanuONchMMUe7M/iQos6GcLXFk8gmmUfLzwPobQTP1C4]

[Refresh: $2y$10$x8UgIewq3ckLrQi79z/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO]

Example request:

curl -X PUT \
    "http://api-service.loc/user/1/instance/1/messages/1/1?userId=et&instance=vero&chatId=odit&typeMessage=voluptate" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"body":"quaerat"}'
const url = new URL(
    "http://api-service.loc/user/1/instance/1/messages/1/1"
);

let params = {
    "userId": "et",
    "instance": "vero",
    "chatId": "odit",
    "typeMessage": "voluptate",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "body": "quaerat"
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "sent": true,
    "message": "Sent to 79220000001@c.us",
    "id": "true_79220000001@c.us_3EB0A79D45C44643F165",
    "queueNumber": 1089,
    "status_chat": "existing"
}

HTTP Request

PUT user/{userId}/instance/{instance}/messages/{chatId}/{type}

Query Parameters

Parameter Status Description
userId required The ID of a user of the cabinet ID user Example 2331
instance required The instance of a user. Example 334456
chatId required The ID of a chat (phone). Example 79220000002
typeMessage required Request Type [text, file, image, ptt, link, location, contact, read, typing, record]

Body Parameters

Parameter Type Status Description
body required optional Text Message support emoji. [x-www-form-urlencoded]

readMessages


Requires authentication [Function to set status READ for messages]

[Headers]

[Authentication: 2y$10$qeCKubxG.yPanuONchMMUe7M/iQos6GcLXFk8gmmUfLzwPobQTP1C4]

[Refresh: $2y$10$x8UgIewq3ckLrQi79z/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO]

Example request:

curl -X PUT \
    "http://api-service.loc/user/1/instance/1/read/1?userId=et&instance=rem&chatId=modi" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/user/1/instance/1/read/1"
);

let params = {
    "userId": "et",
    "instance": "rem",
    "chatId": "modi",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "PUT",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "read": true,
    "message": null,
    "chatId": "79220000002@c.us"
}

HTTP Request

PUT user/{userId}/instance/{instance}/read/{chatId}

Query Parameters

Parameter Status Description
userId required The ID of a user of the cabinet ID user Example 2331
instance required The instance of a user. Example 334456
chatId required The ID of a chat (phone). Example 79220000002

deleteMessages


Requires authentication [Delete message function (only works 2 hours after sending message for deleted message)]

[Headers]

[Authentication: 2y$10$qeCKubxG.yPanuONchMMUe7M/iQos6GcLXFk8gmmUfLzwPobQTP1C4]

[Refresh: $2y$10$x8UgIewq3ckLrQi79z/A7.OuwobUOw3jT.yQ7lqzIt6R0gbVlhqeO]

Example request:

curl -X DELETE \
    "http://api-service.loc/user/1/instance/1/messages/1/1?userId=eum&instance=placeat&chatId=inventore&messageId=eveniet" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://api-service.loc/user/1/instance/1/messages/1/1"
);

let params = {
    "userId": "eum",
    "instance": "placeat",
    "chatId": "inventore",
    "messageId": "eveniet",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "sent": true,
    "message": "message deleted"
}

HTTP Request

DELETE user/{userId}/instance/{instance}/messages/{chatId}/{messageId}

Query Parameters

Parameter Status Description
userId required The ID of a user of the cabinet ID user Example 2331
instance required The instance of a user. Example 334456
chatId required The ID of a chat (phone). Example 79220000002
messageId required The ID of a message. Example true_79220000002@c.us_3EB0A79D45C44643F165