Layer 220
ChannelsCreateChannel
Create a supergroup/channel.
method
Users
channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates;
Parameters
| Name | Type | Description |
|---|---|---|
| Flags | # | Flags, see TL conditional fields |
| Broadcast | flags.0?true | Whether to create a channel |
| Megagroup | flags.1?true | Whether to create a supergroup |
| ForImport | flags.3?true | Whether the supergroup is being created to import messages from a foreign chat service using messages. init History Import |
| Forum | flags.5?true | Whether to create a forum |
| Title | string | Channel title |
| About | string | Channel description |
| GeoPoint | flags.2?InputGeoPoint | Geogroup location, see here for more info on geogroups. |
| Address | flags.2?string | Geogroup address, see here for more info on geogroups. |
| TtlPeriod | flags.4?int | Time-to-live of all messages that will be sent in the supergroup: once message. date+message. ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use messages. set Default History TTL to edit this value later. |
Returns
UpdatesPossible Errors
| Code | Type | Description |
|---|---|---|
| 400 | ADDRESS_INVALID | The specified geopoint address is invalid. |
| 400 | CHANNELS_ADMIN_LOCATED_TOO_MUCH | The user has reached the limit of public geogroups. |
| 400 | CHANNELS_TOO_MUCH | You have joined too many channels/supergroups. |
| 400 | CHAT_ABOUT_TOO_LONG | Chat about too long. |
| 500 | CHAT_INVALID | Invalid chat. |
| 400 | CHAT_TITLE_EMPTY | No chat title provided. |
| 400 | TTL_PERIOD_INVALID | The specified TTL period is invalid. |
| 403 | USER_RESTRICTED | You're spamreported, you can't create channels or chats. |
Gogram Example
// ChannelsCreateChannel - using Params struct result, err := client.ChannelsCreateChannel(&tg.ChannelsCreateChannelParams{ Title: "...", About: "...", // Optional fields: // Broadcast: true, // Megagroup: true, // ForImport: true, // Forum: true, // ... }) if err != nil { // handle error } // result is *tg.Updates