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
})();import {Api, TelegramClient} from 'telegram';
import {StringSession} from 'telegram/sessions';
const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
const result: Api.Updates = 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
Result
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
Related pages
How to handle channels, supergroups, groups, and what's the difference between them.
Last updated
Was this helpful?