Create invitation link
Creates a link for joining a closed chat
Function CreateInvitationLink(Val Token, Val ChatID, Val Title = "", Val ExpirationDate = "", Val UserLimit = 0) Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
Token | --token | String | ✔ | Bot token |
ChatID | --chat | String, Number | ✔ | Target chat ID or ChatID*TopicID |
Title | --title | String | ✖ | Invitation title |
ExpirationDate | --expire | Date | ✖ | Link expiration date (permanent if not specified) |
UserLimit | --limit | Number | ✖ | User limit (infinite if not specified) |
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
tip
Method at API documentation: createChatInviteLink
1C:Enterprise/OneScript code example
Token = "6129457865:AAFyzNYOAFbu...";
ChannelID = "@testsichee";
Day = 86400;
CurrentDate = OPI_Tools.GetCurrentDate();
Title = "Link " + String(CurrentDate);
Expiration = CurrentDate + Day;
UnixExpiration = OPI_Tools.UNIXTime(Expiration);
Result = OPI_Telegram.CreateInvitationLink(Token, ChannelID, Title, Expiration, 200);
- Bash
- CMD/Bat
oint telegram CreateInvitationLink \
--token "***" \
--chat "@testsichee" \
--expire "2024-11-23T14:14:35.829905" \
--title "Link 22.11.2024 14:14:35" \
--limit 200
oint telegram CreateInvitationLink ^
--token "***" ^
--chat "@testsichee" ^
--expire "2024-11-23T14:14:35.829905" ^
--title "Link 22.11.2024 14:14:35" ^
--limit 200
Result
{
"ok": true,
"result": {
"invite_link": "https://t.me/+hUgH4yjb_7wyZDBi",
"name": "Link 09.10.2024 8:58:10",
"creator": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"expire_date": 1728547090,
"member_limit": 200,
"creates_join_request": false,
"is_primary": false,
"is_revoked": false
}
}