Telegram API
6 endpoints for channels, posts and comments.
Every Telegram endpoint, by group. Each is a GET under /v1/telegram.
Quick Reference
| Property | Value |
|---|---|
| Base path | /v1/telegram |
| Endpoints | 6 |
| Credits | 1 a call |
| Guide | Telegram |
Accounts
GETProfile
/v1/telegram/profileA channel, group, account or bot with its counts.1 creditGETProfile Posts/v1/telegram/profile/postsA channel's posts, newest first.1 creditGETProfile Search/v1/telegram/profile/searchA search inside a channel, newest first.1 creditGETInvite/v1/telegram/inviteWhat an invite link opens.1 creditPosts
GETPost
/v1/telegram/postOne channel post or group message.1 creditGETPost Comments/v1/telegram/post/commentsA post's comments, newest first.1 creditExample Request
Every Telegram endpoint is called this way: its path, and what to read as query parameters.
import { SocialAPI } from "@socialapihq/sdk";
const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });
const { data } = await client.telegram.profile({ handle: "durov" });{
"data": {
"id": "durov",
"username": "durov",
"displayName": "Pavel Durov",
"bio": "Founder/CEO/Owner of Telegram.\n\nFounder of TON/Gram.\n\nHalf-part troll.",
"avatarUrl": "https://cdn4.telesco.pe/file/hP1ROci3RQKSNiu0EqKtHT5U_iI_Jm-E7UrJ9lbUzyu6QI_qMAaKFwsVjzz49Sdy_ZR-18Ft4p7oI__K_XxnxDuQg_nn2dDVt4LT7kqv93S7jMBPAcoh_jubhlQGSekmhXOaYWT-Y6n3ZFghrHSd0ACzcmJb4lreWP4RvCfBKWRK2ivBsagTBrZe4lrXobwh4Ukti7XlIoRQduwiGjHrQoW0TRpcvKq3KINvKqmKvAmiAlWb-072JjjclzFbFL9otA3RHqetfL3fHXLTUWwp3yFy4zhTQezX_iYheYVQ3RqiV8JyGB9pPmjh7EmwJxyJ_BDy3pZCVZA4U21uBq8mbw.jpg",
"url": "https://t.me/durov",
"verified": true,
"private": false,
"followers": 9853398,
"following": null,
"likes": null,
"posts": null,
"externalUrl": null,
"createdAt": null,
"ext": {
"kind": "channel",
"online": null,
"monthlyUsers": null,
"channelId": "1006503122",
"photos": 106,
"videos": 47,
"files": null,
"links": 204,
"previewable": true
}
}
}Errors
A call that fails costs nothing. See Errors for every code.