<metaproperty="description"content="Chats and channels may have a public username or a private invite link: private invite links may be further enhanced with per-user join requests.">
<metaproperty="og:title"content="Invites">
<metaproperty="og:image"content="">
<metaproperty="og:description"content="Chats and channels may have a public username or a private invite link: private invite links may be further enhanced with per-user join requests.">
<p><ahref="/api/channel">Chats and channels</a> may have a public username or a private invite link: private invite links may be further enhanced with per-user <ahref="https://telegram.org/blog/shared-media-scrolling-calendar-join-requests-and-more#join-requests-for-groups-and-channels">join requests</a>.</p>
<p>Only <ahref="/api/channel">supergroups and channels</a> may have a public usernames: <ahref="/api/channel">normal groups</a> must be migrated to a <ahref="/api/channel">supergroup</a> before they can be assigned a username, see the <ahref="/api/channel#migration">migration docs»</a> for more info. </p>
<p><ahref="/method/channels.updateUsername">channels.updateUsername</a> can be used to directly assign or change the public username of a supergroup or channel.<br>
You can use <ahref="/method/channels.updateUsername">channels.checkUsername</a> before assigning the username to make sure that the specified username is valid and available. </p>
<p><ahref="/method/channels.joinChannel">channels.joinChannel</a> can be used to join a supergroup or channel using peer information obtained using <ahref="/method/contacts.resolveUsername">contacts.resolveUsername</a>.</p>
<p>Private invite links can optionally have an expiration date, a usage limit, and can even be set to only allow users into the channel, supergroup or group upon explicit approval of an admin: see <ahref="#join-requests">join requests»</a> for more info.</p>
<p>Invite links match the following regex: <code>@(?:t|telegram)\.(?:me|dog)/(joinchat/|\+)?([\w-]+)@i</code>.<br>
The first matching group can be passed to the <code>hash</code> parameter of <ahref="/method/messages.checkChatInvite">messages.checkChatInvite</a> to get info about the chat, and <ahref="/method/messages.importChatInvite">messages.importChatInvite</a> to join the chat.<br>
<ahref="/method/messages.checkChatInvite">messages.checkChatInvite</a> may return <ahref="/constructor/chatInvitePeek">chatInvitePeek</a> only for <ahref="/api/channel">supergroups and channels</a>, in which case the user may directly fetch chat messages using <ahref="/api/updates">updates</a>, <ahref="/method/messages.getHistory">messages.getHistory</a> and <ahref="/method/channels.getMessages">channels.getMessages</a> until the time indicated by the <code>expires</code> unixtime field.</p>
<p>Newly created groups, supergroups and channel already have a default invite link.<br>
To generate a new one, use <ahref="/method/messages.exportChatInvite">messages.exportChatInvite</a>.<br>
To get info about existing chat invites, optionally filtering only links created by a given admin, use <ahref="/method/messages.getExportedChatInvites">messages.getExportedChatInvites</a>.<br>
<ahref="/method/messages.getExportedChatInvite">messages.getExportedChatInvite</a> can be used to obtain info about a specific invite link. </p>
<p><ahref="/method/messages.editExportedChatInvite">messages.editExportedChatInvite</a> is used to edit or revoke existing invite links: revoked links cannot be used by users to join the group, but info about revoked links can still be fetched using <ahref="/method/messages.getExportedChatInvites">messages.getExportedChatInvites</a> with the <code>revoked</code> flag set.<br>
Use <ahref="/method/messages.deleteExportedChatInvite">messages.deleteExportedChatInvite</a> to permanently remove an invite link, and <ahref="/method/messages.deleteRevokedExportedChatInvites">messages.deleteRevokedExportedChatInvites</a> to permanently remove a revoked invite link. </p>
<p><ahref="/method/messages.getChatInviteImporters">messages.getChatInviteImporters</a> can be used to fetch info about users that joined using a specific invite link. </p>
<p>Some basic stats about the number of invite links generated by a given admin can be fetched using <ahref="/method/messages.getAdminsWithInvites">messages.getAdminsWithInvites</a>. </p>
<p>If the <code>request_needed</code> flag is set when <ahref="#invite-links">generating or editing an invite link</a>, or if the appropriate option is toggled using <ahref="/method/channels.toggleJoinRequest">channels.toggleJoinRequest</a>, users importing the invite link using <ahref="/method/messages.importChatInvite">messages.importChatInvite</a> will receive an <code>INVITE_REQUEST_SENT</code> RPC error, indicating that an join request was successfully sent to the chat admins. </p>
<p>Related supergroup information will also have the <ahref="/constructor/channel"><code>channel.join_request</code></a> flag set accordingly. </p>
<p>Bot administrators will receive a <ahref="/constructor/updateBotChatInviteRequester">updateBotChatInviteRequester</a> update for each separate join request.<br>
User administrators will receive an <ahref="/constructor/updatePendingJoinRequests">updatePendingJoinRequests</a>, and should invoke <ahref="/method/messages.getChatInviteImporters">messages.getChatInviteImporters</a> with the <code>requested</code> flag set to obtain a list of users waiting to be admitted into the group. </p>
<p>Administrators can then use <ahref="/method/messages.hideChatJoinRequest">messages.hideChatJoinRequest</a> to approve or dismiss a join request, and <ahref="/method/messages.hideAllChatJoinRequests">messages.hideAllChatJoinRequests</a> to approve or dismiss in bulk multiple join requests. </p>
<p>Administrators can also choose to send a message to the user before admitting them into the group: in this case, graphical clients <em>on the user side</em> should display a message on the dialog bar of the chat with the admin, indicating that the chat was initiated by the admin of a chat/channel they have recently requested to join, see the <ahref="/api/action-bar#an-admin-from-a-recent-join-request-is-contacting-you">action bar documentation»</a> for more info. </p>
<p>Users may also be directly invited to groups and channels during their creation (<ahref="/api/channel">basic groups</a> via <ahref="/method/messages.createChat">messages.createChat</a>) or afterwards (<ahref="/api/channel">basic groups</a> via <ahref="/method/messages.addChatUser">messages.addChatUser</a>, <ahref="/api/channel">supergroups and channels</a> via <ahref="/method/channels.inviteToChannel">channels.inviteToChannel</a>). </p>
<p>The methods will return a <ahref="/constructor/messages.invitedUsers">messages.invitedUsers</a> constructor, containing a list of <ahref="/api/updates">updates</a> about successfully invited users (and eventually info about the created group), and a list of <ahref="/constructor/missingInvitee">missingInvitee</a>, with a list of users that could not be invited for some reason. </p>
<p>Specifically:</p>
<ul>
<li>If none of the <ahref="/constructor/missingInvitee">missingInvitee</a> flags are set, we could not add the user because of their privacy settings, and we can create and directly share an <ahref="#invite-links">invite link</a> with them using a normal message, instead. </li>
<li>If the <ahref="/constructor/missingInvitee">missingInvitee</a>.<code>premium_would_allow_invite</code> flag is set, we could not add the user <em>only because</em> the current account needs to purchase a <ahref="/api/premium">Telegram Premium</a> subscription to complete the operation. </li>
<li>If the <ahref="/constructor/missingInvitee">missingInvitee</a>.<code>premium_required_for_pm</code> flag is set, we could not add the user because of their privacy settings, and additionally, the current account needs to purchase a <ahref="/api/premium">Telegram Premium</a> subscription to directly share an invite link with the user via a private message.</li>