Platforms
Telegram
Read public Telegram channels with their posts and searches, channel posts and group messages with their comments, and invite links.
Read a channel, group, account or bot, a public channel's posts back to its first, a search inside a channel, one channel post or group message with its comments, and what an invite link opens.
Quick Reference
| Property | Value |
|---|---|
| Endpoints | 6 |
| Channels and groups by | handle or url |
| Posts by | url or id (durov/574) |
| Invites by | url or code |
| Posts a page | 20 |
| Comments a page | 100, then 50 |
| Counts | Subscribers, members, views, reactions |
Channels and Groups
| Endpoint | Returns | Credits |
|---|---|---|
profile | A channel, group, account or bot with its counts. | 1 |
profile/posts | A channel's posts, newest first. | 1 |
profile/search | A search inside a channel, newest first. | 1 |
invite | What an invite link opens. | 1 |
Read a Profile
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
}
}
}- A profile is a channel, a group, an account or a bot, as
ext.kindsays. - A channel's
followersare its subscribers and a group's its members, both exact. A group also hasext.online, and a botext.monthlyUsers. - A channel's
extalso has its photo, video, file and link counts and its numeric id (channelId). - A
handleis taken with or without@, and aurlast.me/durovort.me/s/durov.
Channel Posts
- A channel's posts come newest first, 20 a page, back to its first post.
- A search finds the posts of one channel with every word of
query, or a#hashtag's, 20 a page. - A group's messages are read one at a time, with a message's link. A group, an account or a bot asked for its posts returns
400, at no cost.
Invites
An invite link (t.me/+…) opens a private channel or group: its title, description, picture and subscribers or members. An invite that opens nothing returns 404, at no cost.
Posts
| Endpoint | Returns | Credits |
|---|---|---|
post | One channel post or group message. | 1 |
post/comments | A post's comments, newest first. | 1 |
Post Fields
- A post's
idis its chat's name and its number there (durov/574), as its link ends. - The
statshave its views and its reactions summed aslikes. Each reaction is inext.reactions, and stars paid as reactions inext.stars. - Views and reactions past 1,000 are rounded, as Telegram shows them (
596K). The figure as shown is inext.viewsShown. - Its
mediais its photos, videos and sticker. A video'surlis its file, signed for a few hours. A video too large for the web has its cover alone, andext.mediaHidden. - Its
extalso has its link preview, the post it was forwarded from, the message it answers, its signature and whether it was edited. - A group's message names its sender as
authorand has no views.
Comments
A channel post's comments are its linked group's replies to it, and a group message's are the thread it is in. The newest 100 come first, then 50 a page, each with its sender, media and reactions, and the comment it answers as parentId. A commenter without a public name has no author, only ext.authorName. A post without comments returns an empty list.