channels.createChannel

Create a supergroup/channel.

Example

const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.channels.createChannel({
        broadcast: true,
        megagroup: true,
        title: 'random string here',
        about: 'random string here',
        geoPoint: new Api.InputGeoPoint({...}),
        address: 'random string here',
        }));
    console.log(result); // prints the result
})();

TL schema

Parameters

Name

Type

Description

flags

broadcast

Whether to create a channel

megagroup

Whether to create a supergroup

title

Channel title

about

Channel description

geo_point

Geogroup location

address

Geogroup address

Result

Updates

Possible errors

Code

Type

Description

400

CHANNELS_TOO_MUCH

You have joined too many channels/supergroups

400

CHAT_ABOUT_TOO_LONG

Chat about too long

400

CHAT_TITLE_EMPTY

No chat title provided

403

USER_RESTRICTED

You're spamreported, you can't create channels or chats.

Can bots use this methd ?

yes

How to handle channels, supergroups, groups, and what's the difference between them.

Last updated

Was this helpful?