Платформенная аналитика API
Telegram API
Телеграм имеет более 1 миллиарда активных пользователей в месяц, которые обмениваются сообщениями, каналами, группами, голосовыми заметками, ботами и медиа, что делает его важным для прямой дистрибуции, управления сообществами и быстрого распространения новостей.
Справочник API Версия: 1.0.0 7 Точки доступа Аутентификация
Базовый URL
https://api.pressmonitor.com/telegram/v1 Аутентификация
Все запросы используют аутентификацию с токеном Bearer. Добавьте заголовок Authorization ко всем вызовам.
Authorization: Bearer YOUR_TOKEN GET
/bot-info Информация о боте
Bot Info
Параметры
| Имя | Тип | Местоположение | Обязательно | Описание |
|---|---|---|---|---|
| username | string | query | Да | Имя пользователя |
Примеры кода
curl --request GET \ --url 'https://api.pressmonitor.com/telegram/v1/bot-info?username=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/telegram/v1/bot-info?username=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/telegram/v1/bot-info" querystring = {"username":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/telegram/v1/bot-info?username=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/telegram/v1/bot-info?username=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Ответы
200 Успешно
GET
/channel-info Информация о канале
Channel Info
Параметры
| Имя | Тип | Местоположение | Обязательно | Описание |
|---|---|---|---|---|
| username | string | query | Да | Имя пользователя |
Примеры кода
curl --request GET \ --url 'https://api.pressmonitor.com/telegram/v1/channel-info?username=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/telegram/v1/channel-info?username=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/telegram/v1/channel-info" querystring = {"username":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/telegram/v1/channel-info?username=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/telegram/v1/channel-info?username=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Ответы
200 Успешно
GET
/get-messages Получить сообщения
Get Messages
Параметры
| Имя | Тип | Местоположение | Обязательно | Описание |
|---|---|---|---|---|
| username | string | query | Да | Имя пользователя |
| offset | string | query | Нет | Смещение |
Примеры кода
curl --request GET \ --url 'https://api.pressmonitor.com/telegram/v1/get-messages?username=SOME_STRING_VALUE&offset=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/telegram/v1/get-messages?username=SOME_STRING_VALUE&offset=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/telegram/v1/get-messages" querystring = {"username":"SOME_STRING_VALUE","offset":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/telegram/v1/get-messages?username=SOME_STRING_VALUE&offset=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/telegram/v1/get-messages?username=SOME_STRING_VALUE&offset=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Ответы
200 Успешно
GET
/group-info Информация о группе
Group Info
Параметры
| Имя | Тип | Местоположение | Обязательно | Описание |
|---|---|---|---|---|
| username | string | query | Да | Имя пользователя |
Примеры кода
curl --request GET \ --url 'https://api.pressmonitor.com/telegram/v1/group-info?username=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/telegram/v1/group-info?username=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/telegram/v1/group-info" querystring = {"username":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/telegram/v1/group-info?username=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/telegram/v1/group-info?username=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Ответы
200 Успешно
GET
/search Поиск
Search
Параметры
| Имя | Тип | Местоположение | Обязательно | Описание |
|---|---|---|---|---|
| keyword | string | query | Да | Ключевое слово |
Примеры кода
curl --request GET \ --url 'https://api.pressmonitor.com/telegram/v1/search?keyword=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/telegram/v1/search?keyword=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/telegram/v1/search" querystring = {"keyword":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/telegram/v1/search?keyword=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/telegram/v1/search?keyword=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Ответы
200 Успешно
GET
/search-hashtag Поиск по хештегу
Search Hashtag
Параметры
| Имя | Тип | Местоположение | Обязательно | Описание |
|---|---|---|---|---|
| hashtag | string | query | Да | Хештег |
| offset | string | query | Нет | Смещение |
Примеры кода
curl --request GET \ --url 'https://api.pressmonitor.com/telegram/v1/search-hashtag?hashtag=SOME_STRING_VALUE&offset=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/telegram/v1/search-hashtag?hashtag=SOME_STRING_VALUE&offset=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/telegram/v1/search-hashtag" querystring = {"hashtag":"SOME_STRING_VALUE","offset":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/telegram/v1/search-hashtag?hashtag=SOME_STRING_VALUE&offset=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/telegram/v1/search-hashtag?hashtag=SOME_STRING_VALUE&offset=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Ответы
200 Успешно
GET
/user-info Информация о пользователе
User Info
Параметры
| Имя | Тип | Местоположение | Обязательно | Описание |
|---|---|---|---|---|
| username | string | query | Да | Имя пользователя |
Примеры кода
curl --request GET \ --url 'https://api.pressmonitor.com/telegram/v1/user-info?username=SOME_STRING_VALUE' const http = require("https"); const options = { "method": "GET", "hostname": "api.pressmonitor.com", "port": null, "path": "/telegram/v1/user-info?username=SOME_STRING_VALUE", "headers": {} }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end(); import requests url = "https://api.pressmonitor.com/telegram/v1/user-info" querystring = {"username":"SOME_STRING_VALUE"} response = requests.request("GET", url, params=querystring) print(response.text) <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.pressmonitor.com/telegram/v1/user-info?username=SOME_STRING_VALUE", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.pressmonitor.com/telegram/v1/user-info?username=SOME_STRING_VALUE") .get() .build(); Response response = client.newCall(request).execute(); Ответы
200 Успешно