1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-29 02:57:35 +02:00
OpenIntegrations/docs/en/md/Telegram/Administration/Create-invitation-link.md

69 lines
1.7 KiB
Markdown
Raw Normal View History

---
sidebar_position: 3
---
# Create invitation link
Creates a link for joining a closed chat
2024-07-10 12:58:29 +02:00
`Function CreateInvitationLink(Val Token, Val ChatID, Val Title = "", Val ExpirationDate = "", Val UserLimit = 0) Export`
| Parameter | CLI option | Type | Destination |
|-|-|-|-|
| 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
2024-07-10 13:05:58 +02:00
<br/>
2024-07-10 12:58:29 +02:00
```bsl title="Code example"
2024-07-10 13:24:11 +02:00
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);
```
```sh title="CLI command example"
oint telegram CreateInvitationLink --token "6129457865:AAFyzNYOAFbu..." --chat %chat% --title %title% --expire %expire% --limit %limit%
```
```json title="Result"
2024-07-10 13:11:17 +02:00
{
"ok": true,
"result": {
"invite_link": "https://t.me/+W-9MzjOejStiYzYy",
"name": "Link 05/30/2024 12:34:59",
"creator": {
"id": 6129457865,
"is_bot": true,
"first_name": "Vitaly The Bot",
"username": "sicheebot"
},
"expire_date": 1717155300,
"member_limit": 200,
"creates_join_request": false,
"is_primary": false,
"is_revoked": false
}
}
```