Messenger API
Всё, что панель умеет с подключённым аккаунтом Telegram, WhatsApp или Instagram, — через REST: один ключ, один формат ответа, по разделам.
Контакты (CRM-карточка)
Теги, переменные, баллы, рефералы и отслеживаемые ссылки каждого контакта — одинаково в Telegram, WhatsApp и Instagram.
Карточка контакта общая для всех сетей: {id} может быть Telegram-аккаунтом, wa_{id} или ig_{id}. Теги, переменные и баллы — те же, что используют правила, сценарии и шаблоны ({{contact.x}}, {{points}}, {{rank}}).
Base URL: https://chatvendor.net/api/v1 · каждый ответ {"success": true, "data": …}
GET
/channels/{id}/contacts
Contact cards (tags, variables, points, referrals); id = Telegram account, wa_{id} or ig_{id}. Query: tag, q, var, limit, offset
channels:read
Право: channels:read
Параметры
idpath · integerобязательноChannel id (from GET /channels)
Ответ 200 · Contact[]
peer_id integertitle stringusername stringtype stringtags string[]vars objectpoints integerreferrals_count integerreferrer_peer_id integerref_code stringref_link stringnotes stringconverted_at string (date-time)last_message_at string (date-time)
curl https://chatvendor.net/api/v1/channels/1/contacts \
-H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
GET
/channels/{id}/contacts/{peer}
One contact card
channels:read
Право: 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 · Contact
peer_id integertitle stringusername stringtype stringtags string[]vars objectpoints integerreferrals_count integerreferrer_peer_id integerref_code stringref_link stringnotes stringconverted_at string (date-time)last_message_at string (date-time)
curl https://chatvendor.net/api/v1/channels/1/contacts/@username \
-H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
PATCH
/channels/{id}/contacts/{peer}
Change tags / variables / notes of a contact
channels:write
Право: 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)
tagsstring[]add_tagsstring[]remove_tagsstring[]varsobjectnotesstringОтвет 200 · Contact
peer_id integertitle stringusername stringtype stringtags string[]vars objectpoints integerreferrals_count integerreferrer_peer_id integerref_code stringref_link stringnotes stringconverted_at string (date-time)last_message_at string (date-time)
curl -X PATCH https://chatvendor.net/api/v1/channels/1/contacts/@username \
-H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
-H "Content-Type: application/json" \
-d '[]'
POST
/channels/{id}/contacts/{peer}/points
Add / deduct points (ref deduplicates)
channels:write
Право: 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)
deltaintegerreasonstringrefstringОтвет 200
OK
curl -X POST https://chatvendor.net/api/v1/channels/1/contacts/@username/points \
-H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
-H "Content-Type: application/json" \
-d '{"delta":1,"reason":"…","ref":"…"}'
GET
/channels/{id}/leaderboard
Points leaderboard
channels:read
Право: channels:read
Параметры
idpath · integerобязательноChannel id (from GET /channels)
Ответ 200
OK
curl https://chatvendor.net/api/v1/channels/1/leaderboard \
-H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
GET
/channels/{id}/links
Tracked links ({{link:name}} placeholders) with click counts
channels:read
Право: channels:read
Параметры
idpath · integerобязательноChannel id (from GET /channels)
Ответ 200
OK
curl https://chatvendor.net/api/v1/channels/1/links \
-H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
POST
/channels/{id}/links
Create / update a tracked link
channels:write
Право: channels:write
Параметры
idpath · integerобязательноChannel id (from GET /channels)
Тело запроса (application/json)
namestringurlstringtagstringpeer_idintegerОтвет 200
OK
curl -X POST https://chatvendor.net/api/v1/channels/1/links \
-H "Authorization: Bearer cv_live_xxxxxxxxxxxx"
-H "Content-Type: application/json" \
-d '[]'