Перейти к содержимому
ChatVendor ChatVendor

Messenger API

Всё, что панель умеет с подключённым аккаунтом Telegram, WhatsApp или Instagram, — через REST: один ключ, один формат ответа, по разделам.

WhatsApp

Чаты, сообщения, файлы и шаблоны номера WhatsApp Business (wa_{id}).

Номера WhatsApp в GET /channels имеют id вида wa_12; {peer} — телефон клиента в международном формате. Свободный текст разрешён только 24 часа после последнего сообщения клиента — вне окна отправляйте одобренный шаблон.

Base URL: https://chatvendor.net/api/v1 · каждый ответ {"success": true, "data": …}

GET /channels/wa_{id}/dialogs WhatsApp: chats of a number

Право: channels:read

Параметры

idpath · integerобязательно

Channel id (from GET /channels)

qquery · string
unreadquery · integer

Ответ 200 · Dialog[]

peer_id integertype stringtitle stringusername stringunread_count integerlast_message_at string (date-time)last_message_text string

curl https://chatvendor.net/api/v1/channels/wa_1/dialogs \
  -H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
GET /channels/wa_{id}/dialogs/{peer}/messages WhatsApp: messages of a chat (peer = phone in international format)

Право: channels:read

Параметры

idpath · integerобязательно

Channel id (from GET /channels)

peerpath · stringобязательно

Telegram peer: numeric id (channels/groups negative, e.g. -1001234567890), @username or phone

Ответ 200 · ChatMessage[]

id integerchat_id integersender_id integersender_name stringout booleandate string (date-time)text stringmedia objectreply_to integertopic_id integerbuttons object[][]

curl https://chatvendor.net/api/v1/channels/wa_1/dialogs/@username/messages \
  -H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
POST /channels/wa_{id}/dialogs/{peer}/messages WhatsApp: send text, an approved template, or reply buttons

Право: channels:write

Параметры

idpath · integerобязательно

Channel id (from GET /channels)

peerpath · stringобязательно

Telegram peer: numeric id (channels/groups negative, e.g. -1001234567890), @username or phone

Тело запроса (application/json)

textstring
reply_tointeger
templatestring
languagestring
componentsobject[]
buttonsobject[]
buttons[].idstring
buttons[].titlestring

Ответ 200 · ChatMessage

id integerchat_id integersender_id integersender_name stringout booleandate string (date-time)text stringmedia objectreply_to integertopic_id integerbuttons object[][]

curl -X POST https://chatvendor.net/api/v1/channels/wa_1/dialogs/@username/messages \
  -H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
  -H "Content-Type: application/json" \
  -d '[]'
POST /channels/wa_{id}/dialogs/{peer}/file WhatsApp: send a file (multipart: file, caption, as=auto|document|voice)

Право: channels:write

Параметры

idpath · integerобязательно

Channel id (from GET /channels)

peerpath · stringобязательно

Telegram peer: numeric id (channels/groups negative, e.g. -1001234567890), @username or phone

multipart/form-data — поля перечислены в описании выше.

Ответ 200 · ChatMessage

id integerchat_id integersender_id integersender_name stringout booleandate string (date-time)text stringmedia objectreply_to integertopic_id integerbuttons object[][]

curl -X POST https://chatvendor.net/api/v1/channels/wa_1/dialogs/@username/file \
  -H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
  -F "file=@photo.jpg" -F "caption=…"
POST /channels/wa_{id}/dialogs/{peer}/read WhatsApp: mark the chat as read

Право: channels:write

Параметры

idpath · integerобязательно

Channel id (from GET /channels)

peerpath · stringобязательно

Telegram peer: numeric id (channels/groups negative, e.g. -1001234567890), @username or phone

Ответ 200

OK

curl -X POST https://chatvendor.net/api/v1/channels/wa_1/dialogs/@username/read \
  -H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
GET /channels/wa_{id}/dialogs/{peer}/messages/{message}/media WhatsApp: download media

Право: channels:read

Параметры

idpath · integerобязательно

Channel id (from GET /channels)

peerpath · stringобязательно

Telegram peer: numeric id (channels/groups negative, e.g. -1001234567890), @username or phone

messagepath · integerобязательно

Message id

Ответ 200

The file

curl https://chatvendor.net/api/v1/channels/wa_1/dialogs/@username/messages/123/media \
  -H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
GET /channels/wa_{id}/templates WhatsApp: message templates of the number

Право: channels:read

Параметры

idpath · integerобязательно

Channel id (from GET /channels)

Ответ 200 · Template[]

name stringstatus stringcategory stringlanguage stringbody string

curl https://chatvendor.net/api/v1/channels/wa_1/templates \
  -H "Authorization: Bearer cv_live_xxxxxxxxxxxx"