Документация Telegram API
Описание Telegram API для сервиса Wappi
С помощью этого API можно осуществлять прием и отправку сообщений через HTTP-запросы, а также работать с чатами, контактами, группами и каналами. Это так называемый Telegram User API, который подойдет, если вы хотите использовать личный телеграм аккаунт в качестве userbot или для иных действий.
МЕТОДЫ ОТПРАВКИ СООБЩЕНИЯ
Вы можете отправить сообщение в Telegram синхронной или асинхронной командой. Асинхронные методы выполняют запросы с постановкой в очередь, в ответе придет сообщение о постановке в очередь и id задачи. Синхронные методы отправления сообщений выполняются сразу и позволяют получить в ответе результат запроса
БЕЗОПАСНОСТЬ
Мы используем API Telegram, который является частью экосистемы Telegram. Если вы используете наш API для флуда, спама, фейковых подписчиков, счетчиков просмотров каналов, Telegram может вас забанить. Рекомендуем использовать свои собственные socks5 прокси для подключения.
ОСОБЕННОСТИ API
Токен авторизации передается в заголовке Authorization HTTP запроса. Profile_id передается query параметром в каждом запросе.
ТЕСТИРОВАНИЕ API
Чтобы протестировать API необходимо авторизоваться. Для этого на данной странице нажмите Authorize, в появившемся окне в поле Value вставьте ваш токен api. Токен можно найти в дашборде на странице вашего профиля - Вход в личный кабинет.
КОЛЛЕКЦИЯ POSTMAN
Для удобства тестирования нашего API можете воспользоваться коллекцией Postman. Там же можно найти примеры реализованных методов на разных языках программирования.
Типы уведомлений Webhook
Есть несколько статусов отправленных сообщений - pending, delivered, read.
{
"messages": {
"id": "5889",
"profile_id": "51a8107a-5442",
"wh_type": "delivery_status",
"timestamp": "2025-03-17T14:57:59.611515092+03:00",
"time": 1742212679,
"from": "5279188641",
"to": "60227586",
"chat_id": "60227586",
"status": "delivered",
"task_id": "f7ff034a-0455-4c96-bf5a-ed5915ee300f"
}
}
Есть несколько статусов профиля - online, offline
{
"messages": [
{
"wh_type": "authorization_status",
"profile_id": "fae370e3-0a1a",
"status": "online",
"phone": "966507585521",
"timestamp": "2024-03-02T15:52:38.75126472+03:00",
"time": 1709383958
}
]
}
{
"messages": [
{
"wh_type": "application_status",
"profile_id": "fae370e3-0a1a",
"status": "online",
"phone": "966507585521",
"timestamp": "2024-03-02T15:52:27.996591556+03:00",
"time": 1709383947
}
]
}
{
"messages": [
{
"id": "5902",
"profile_id": "51a8107a-5442",
"wh_type": "incoming_message",
"timestamp": "2025-03-17T15:14:37+03:00",
"time": 1742213677,
"body": "Текстовое сообщение",
"type": "text",
"from": "60227586",
"to": "5279188641",
"senderName": "Sinn",
"chatId": "60227586",
"caption": null,
"from_where": "phone",
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"username": "sinay",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": false,
"chat_type": "user",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false
}
]
}
Обратите внимание, все изображения отдаются в формате base64.
{
"messages": [
{
"id": "5903",
"profile_id": "51a8107a-5442",
"wh_type": "incoming_message",
"timestamp": "2025-03-17T15:16:03+03:00",
"time": 1742213763,
"body": "JVBERi0xLjcNCiXi48/TDQo1IDAgb2JqD",
"type": "image",
"from": "60227586",
"to": "5279188641",
"senderName": "Sinn",
"chatId": "60227586",
"caption": "Подпись",
"from_where": "phone",
"mimetype": "image/jpeg",
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"username": "sinay",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": false,
"chat_type": "user",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false,
"file_link": "https://wapi-u.storage.yandexcloud.net/51a",
"file_link_expire": 1742472963
}
]
}
Обратите внимание, что все видео отдаются в формате base64.
{
"messages": [
{
"id": "5904",
"profile_id": "51a8107a-5442",
"wh_type": "incoming_message",
"timestamp": "2025-03-17T15:18:38+03:00",
"time": 1742213918,
"body": "JVBERi0xLjcNCiXi48/TDQo1IDAgb2JqD",
"type": "video",
"from": "60227586",
"to": "5279188641",
"senderName": "Sinn",
"chatId": "60227586",
"caption": "Подпись",
"from_where": "phone",
"file_name": "video.mp4",
"mimetype": "video/mp4",
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"username": "sinay",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": false,
"chat_type": "user",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false,
"file_link": "https://wapi-u.storage.yandexcloud.net/51a",
"file_link_expire": 1742473119
}
]
}
Обратите внимание, что все файлы и документы отдаются в формате base64.
{
"messages": [
{
"id": "5916",
"profile_id": "51a8107a-5442",
"wh_type": "incoming_message",
"timestamp": "2025-03-17T15:38:57+03:00",
"time": 1742215137,
"body": "JVBERi0xLjcNCiXi48/TDQo1IDAgb2JqD",
"type": "document",
"from": "60227586",
"to": "5279188641",
"senderName": "Minay",
"chatId": "60227586",
"caption": "",
"from_where": "phone",
"file_name": "Счет на оплату № 24 от 17 марта 2025 г.pdf",
"mimetype": "application/pdf",
"contact_name": "Minay",
"contact_phone": "",
"contact_username": "minayq",
"username": "minayq",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": false,
"chat_type": "user",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false,
"file_link": "https://wapi-u.storage.yandexcloud.net/51a",
"file_link_expire": 1742474338
}
]
}
Обратите внимание, что все файлы аудио отдаются в формате base64.
{
"messages": [
{
"id": "5908",
"profile_id": "51a8107a-5442",
"wh_type": "incoming_message",
"timestamp": "2025-03-17T15:21:59+03:00",
"time": 1742214119,
"body": "JVBERi0xLjcNCiXi48/TDQo1IDAgb2JqD",
"type": "ptt",
"from": "60227586",
"to": "5279188641",
"senderName": "Sinn",
"chatId": "60227586",
"caption": "",
"from_where": "phone",
"mimetype": "audio/ogg",
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"username": "sinay",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": false,
"chat_type": "user",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false,
"length_seconds": 1,
"file_link": "https://wapi-u.storage.yandexcloud.net/51a",
"file_link_expire": 1742473320
}
]
}
Обратите внимание, что все файлы аудио отдаются в формате base64.
{
"messages": [
{
"id": "5909",
"profile_id": "51a8107a-5442",
"wh_type": "incoming_message",
"timestamp": "2025-03-17T15:23:27+03:00",
"time": 1742214207,
"body": "JVBERi0xLjcNCiXi48/TDQo1IDAgb2JqD",
"type": "audio",
"from": "60227586",
"to": "5279188641",
"senderName": "Sinn",
"chatId": "60227586",
"caption": "",
"from_where": "phone",
"file_name": "CyberMafia_-_Hard_Code_(musmore.org).mp3",
"mimetype": "audio/mpeg",
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"username": "sinay",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": false,
"chat_type": "user",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false,
"file_link": "https://wapi-u.storage.yandexcloud.net/51a",
"file_link_expire": 1742473424
}
]
}
{
"messages": [
{
"id": "5910",
"profile_id": "51a8107a-5442",
"wh_type": "incoming_message",
"timestamp": "2025-03-17T15:24:34+03:00",
"time": 1742214274,
"body": "Location { Name: , Latitude: 58.520963, Longitude: 31.275557, DegreesLatitude: 58.520963, DegreesLongitude:
31.275557, Description: , JPEGThumbnail: }",
"type": "location",
"from": "60227586",
"to": "5279188641",
"senderName": "Sinn",
"chatId": "60227586",
"caption": null,
"from_where": "phone",
"location": {
"latitude": 58.52096286259456,
"longitude": 31.275557069637358,
"description": "",
"degreesLatitude": 58.52096286259456,
"degreesLongitude": 31.275557069637358,
"name": ""
},
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"username": "sinay",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": false,
"chat_type": "user",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false,
"file_link_expire": 1742473474
}
]
}
{
"messages": [
{
"id": "5911",
"profile_id": "51a8107a-5442",
"wh_type": "incoming_message",
"timestamp": "2025-03-17T15:25:26+03:00",
"time": 1742214326,
"body": "BEGIN:VCARD \nVERSION:3.0 \nN:Антон Кондиционер;;; \nFN: \nTEL;type=CELL;type=VOICE;type=pref:79116321673
\nEND:VCARD \n",
"type": "vcard",
"from": "",
"to": "5279188641",
"senderName": "",
"chatId": "60227586",
"caption": null,
"from_where": "phone",
"contact": {
"display_name": "Антон Конжиционер",
"phone": "79116321672"
},
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": false,
"chat_type": "user",
"thumbnail": "",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false,
"file_link_expire": 1742473526
}
]
}
{
"messages": [
{
"id": "5889",
"profile_id": "51a8107a-5442",
"wh_type": "outgoing_message_api",
"timestamp": "2025-03-17T14:57:57+03:00",
"time": 1742212677,
"body": "Тест",
"type": "text",
"from": "5279188641",
"to": "60227586",
"senderName": "Varis",
"chatId": "60227586",
"caption": null,
"from_where": "api",
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"username": "varisss",
"phone": "996507585526",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": true,
"chat_type": "user",
"task_id": "f7ff034a-0455-4c96-bf5a-ed5915ee300f",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false
}
]
}
{
"messages": [
{
"id": "5890",
"profile_id": "51a8107a-5442",
"wh_type": "outgoing_message_phone",
"timestamp": "2025-03-17T15:04:13+03:00",
"time": 1742213053,
"body": "Исходящее сообщение с телефона",
"type": "text",
"from": "5279188641",
"to": "60227586",
"senderName": "Varis",
"chatId": "60227586",
"caption": null,
"from_where": "phone",
"contact_name": "Sinn",
"contact_phone": "",
"contact_username": "sinay",
"username": "varisss",
"phone": "996507585526",
"is_forwarded": false,
"isReply": false,
"is_edited": false,
"stanza_id": "",
"is_me": true,
"chat_type": "user",
"thumbnail": "https://fs.wappi.pro/t_6056.jpg",
"picture": "",
"wappi_bot_id": "",
"is_deleted": false,
"is_bot": false
}
]
}