<metaproperty="description"content="Sometimes, when interacting with Telegram users via private or secret chats, an action bar must be shown on top of the chat, offering convenient action buttons or notices regarding the user.">
<metaproperty="og:title"content="Action bar">
<metaproperty="og:image"content="">
<metaproperty="og:description"content="Sometimes, when interacting with Telegram users via private or secret chats, an action bar must be shown on top of the chat, offering convenient action buttons or notices regarding the user.">
<p>Sometimes, when interacting with Telegram users via private or secret chats, an action bar must be shown on top of the chat, offering convenient action buttons or notices regarding the user.</p>
<p>The action bar is represented by the <ahref="/constructor/peerSettings">peerSettings</a> constructor, fetchable using <ahref="/method/messages.getPeerSettings">messages.getPeerSettings</a>; it is also contained in the <ahref="/constructor/userFull">userFull</a> constructor returned by <ahref="/method/users.getFullUser">users.getFullUser</a>.</p>
<p>Changes to the chat bar may also be notified by the server using <ahref="/constructor/updatePeerSettings">updatePeerSettings</a>. </p>
<p>The currently active action bar may also be dismissed using <ahref="/method/messages.hidePeerSettingsBar">messages.hidePeerSettingsBar</a>. </p>
<p>What follows is a list of the various (<em>mutually exclusive</em>) chat bar types, along with the <strong>condition</strong> used to identify each type, by checking the appropriate flags of <ahref="/constructor/peerSettings">peerSettings</a>. </p>
<h3><aclass="anchor"href="#report-spam-block-or-add-contact"id="report-spam-block-or-add-contact"name="report-spam-block-or-add-contact"><iclass="anchor-icon"></i></a>Report spam, block or add contact</h3>
<p>This action bar, associated to a private or secret chat, offers the user buttons to:</p>
<ul>
<li>Report the chat for spam using <ahref="/method/account.reportPeer">account.reportPeer</a> and <ahref="/constructor/inputReportReasonSpam">inputReportReasonSpam</a>.<br>
If the other user has an emoji status, then the bar should also show a notice, indicating that the emoji status is shown next to the user's name because they have purchased <ahref="/api/premium">Telegram Premium</a> (i.e. this is useful to avoid issues if the user uses an emoji status similar to a verified checkmark).<br>
Additionally, if the chat was automatically <ahref="/api/folders#peer-folders">archived»</a> (according to <ahref="/constructor/peerSettings">peerSettings</a>.<code>autoarchived</code>), an extra button can be shown to unarchive the chat <ahref="/api/folders#peer-folders">as specified here»</a> instead of reporting it.</li>
<li>Add the other user of the chat to the contact list using <ahref="/method/contacts.addContact">contacts.addContact</a>.<br>
Optionally, the <ahref="/constructor/peerSettings">peerSettings</a>.<code>need_contacts_exception</code> flag may also be set: if so, the <code>add_phone_privacy_exception</code> flag <strong>must</strong> be set if the user clicks on the add contact button, invoking <ahref="/method/contacts.addContact">contacts.addContact</a>. </li>
<li>Block the other user of the chat from writing to us using <ahref="/method/contacts.block">contacts.block</a> (without setting the <code>my_stories_from</code> flag). </li>
</ul>
<p><strong>Condition</strong>: the <ahref="/constructor/peerSettings">peerSettings</a>.<code>report_spam</code>, <ahref="/constructor/peerSettings">peerSettings</a>.<code>add_contact</code>, <ahref="/constructor/peerSettings">peerSettings</a>.<code>block_contact</code> flags must all be set.</p>
<p>Additionally, if the <ahref="/constructor/peerSettings">peerSettings</a>.<code>geo_distance</code> flag is set, the bar should also display the distance between us and the user, indicating that the user found us by invoking <ahref="/method/contacts.getLocated">contacts.getLocated</a>, because we are currently advertising our location with the same method.</p>
<h3><aclass="anchor"href="#report-spam-or-unarchive"id="report-spam-or-unarchive"name="report-spam-or-unarchive"><iclass="anchor-icon"></i></a>Report spam or unarchive</h3>
<p>This action bar, associated to a private or secret chat, offers the user a button to report the chat for spam using <ahref="/method/account.reportPeer">account.reportPeer</a> and <ahref="/constructor/inputReportReasonSpam">inputReportReasonSpam</a>. </p>
<p>If the other user has an emoji status, then the bar should also show a notice, indicating that the emoji status is shown next to the user's name because they have purchased <ahref="/api/premium">Telegram Premium</a> (i.e. this is useful to avoid issues if the user uses an emoji status similar to a verified checkmark). </p>
<p><strong>Condition</strong>: the <ahref="/constructor/peerSettings">peerSettings</a>.<code>report_spam</code> flag must be set, and the <ahref="/constructor/peerSettings">peerSettings</a>.<code>add_contact</code>, <ahref="/constructor/peerSettings">peerSettings</a>.<code>block_contact</code> flags must <strong>not</strong> be set.</p>
<p>Additionally, if the chat was automatically <ahref="/api/folders#peer-folders">archived»</a> (according to <ahref="/constructor/peerSettings">peerSettings</a>.<code>autoarchived</code>), an extra button can be shown to unarchive the chat <ahref="/api/folders#peer-folders">as specified here»</a> instead of reporting it.</p>
<p>This action bar, associated to a private or secret chat, offers the user a button to add the other user of the chat to the contact list using <ahref="/method/contacts.addContact">contacts.addContact</a>. </p>
<p><strong>Conditions</strong>: the <ahref="/constructor/peerSettings">peerSettings</a>.<code>add_contact</code> flag must be set <strong>and</strong>:</p>
<ul>
<li>For secret chats, the chat must <strong>not</strong> be archived.</li>
<li>For private chats, the <code>block_contact</code> and <code>report_spam</code> flags must <strong>not</strong> be set.</li>
</ul>
<p>Optionally, the <ahref="/constructor/peerSettings">peerSettings</a>.<code>need_contacts_exception</code> flag may also be set: if so, the <code>add_phone_privacy_exception</code> flag <strong>must</strong> be set if the user clicks on the add contact button, invoking <ahref="/method/contacts.addContact">contacts.addContact</a>. </p>
<p>This action bar, associated to a private or secret chat, offers the user a button to share their phone number with the other user using <ahref="/method/contacts.acceptContact">contacts.acceptContact</a>. </p>
<p><strong>Condition</strong>: the <ahref="/constructor/peerSettings">peerSettings</a>.<code>share_contact</code> flag must be set.</p>
<p>This flag is set and the bar is activated only if the other user has added us as a contact using <ahref="/method/contacts.addContact">contacts.addContact</a>, without using a phone number, and none of the <code>add_contact</code>, <code>report_spam</code>, <code>block_contact</code> flags are set.</p>
<p>This bar indicates that the associated location-based supergroup can be reported for having an unrelated location using a bar button that invokes <ahref="/method/account.reportPeer">account.reportPeer</a> with <code>reason</code><ahref="/constructor/inputReportReasonGeoIrrelevant">inputReportReasonGeoIrrelevant</a>. </p>
<p><strong>Condition</strong>: the <ahref="/constructor/peerSettings">peerSettings</a>.<code>report_geo</code> flag must be set.</p>
<h3><aclass="anchor"href="#invite-new-members"id="invite-new-members"name="invite-new-members"><iclass="anchor-icon"></i></a>Invite new members</h3>
<p>This bar indicates that the associated group was created recently, and it offers a bar button to invite new members using <ahref="/method/messages.addChatUser">messages.addChatUser</a> or <ahref="/method/channels.inviteToChannel">channels.inviteToChannel</a>, depending on whether the associated peer is a <ahref="/api/channel">group or a supergroup</a>.</p>
<p><strong>Condition</strong>: the <ahref="/constructor/peerSettings">peerSettings</a>.<code>invite_members</code> flag must be set.</p>
<h3><aclass="anchor"href="#an-admin-from-a-recent-join-request-is-contacting-you"id="an-admin-from-a-recent-join-request-is-contacting-you"name="an-admin-from-a-recent-join-request-is-contacting-you"><iclass="anchor-icon"></i></a>An admin from a recent join request is contacting you</h3>
<p>This bar indicates that the associated private or secret chat is a chat with an administrator of a <ahref="/api/channel">group or channel</a> to which the user sent a <ahref="/api/invites#join-requests">join request, see here for more info on join requests»</a>. </p>
<p><strong>Condition</strong>: the <code>request_chat_title</code> and <code>request_chat_date</code> fields of <ahref="/constructor/peerSettings">peerSettings</a> must both be set; optionally <code>request_chat_broadcast</code> may also be set:</p>
<ul>
<li><code>request_chat_title</code> - Contains the group/channel's title.</li>
<li><code>request_chat_date</code> - Contains the timestamp indicating when the join request was sent.</li>
<li><code>request_chat_broadcast</code> - This flag is set if the join request is related to a channel (otherwise, the join request is related to a group).</li>
<h3><aclass="anchor"href="#manage-a-connected-business-bot"id="manage-a-connected-business-bot"name="manage-a-connected-business-bot"><iclass="anchor-icon"></i></a>Manage a connected business bot</h3>
<p>This bar indicates that the associated private (non-secret) chat <em>with another user</em> is currently being managed by a <ahref="/api/business#connected-bots">business bot connected to our current account»</a>. </p>
<p><strong>Condition</strong>: the <code>business_bot_id</code> and <code>business_bot_manage_url</code> fields of <ahref="/constructor/peerSettings">peerSettings</a> must both be set; optionally, <code>business_bot_paused</code> and/or <code>business_bot_can_reply</code> may also be set:</p>
<ul>
<li><code>business_bot_id</code> - Contains the ID of the <ahref="/api/business#connected-bots">business bot»</a> managing this chat, used to display info about the bot in the action bar. </li>
<li><code>business_bot_manage_url</code> - Contains a <ahref="/api/links">deep link»</a>, used to open a management menu in the business bot. </li>
<li><code>business_bot_paused</code> - Whether the business bot was paused in this chat using <ahref="/method/account.toggleConnectedBotPaused">account.toggleConnectedBotPaused»</a>. </li>
<li><code>business_bot_can_reply</code> - Whether the business bot can reply to messages in this chat, as specified by the settings during <ahref="/api/business#connected-bots">initial configuration</a>. </li>
</ul>
<p>The main action button of the action bar should be a Pause/Resume button that invokes <ahref="/method/account.toggleConnectedBotPaused">account.toggleConnectedBotPaused»</a>. </p>
<p>The action bar dropdown menu should contain:</p>
<ul>
<li>A button to manage the bot, by opening the deep link in <code>business_bot_manage_url</code></li>
<li>A button to disconnect the bot from this chat, which when pressed should invoke <ahref="/method/account.toggleConnectedBotPaused">account.disablePeerConnectedBot»</a> to permanently disconnect the bot from this peer (this will also hide the action bar, unsetting the <code>business_bot_manage_url</code> and <code>business_bot_id</code> fields). </li>
</ul>
<p>See <ahref="/api/business#connected-bots">here»</a> for more info on business bots.</p></div>