1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-18 23:48:56 +02:00
OpenIntegrations/docs/en/md/Telegram/Administration/Create-invitation-link.md
2024-08-13 15:52:26 +03:00

1.7 KiB

sidebar_position
3

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 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


  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);
    
  oint telegram CreateInvitationLink --token "6129457865:AAFyzNYOAFbu..." --chat %chat% --title "Link  + String(CurrentDate)" --expire %expire% --limit %limit%

{
  "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
  }
  }