<metaproperty="description"content="Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists.">
<metaproperty="og:title"content="Folders">
<metaproperty="og:image"content="">
<metaproperty="og:description"content="Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists.">
<p>Telegram allows placing chats into folders, based on their type, mute status, or other custom criteria, thanks to folder blacklists and whitelists. </p>
<p>The boolean under the <ahref="/api/config#dialog-filters-tooltip"><code>dialog_filters_tooltip</code> JSON key</a> in the result of <ahref="/method/help.getAppConfig">help.getAppConfig</a> can be used to determine whether a folder tooltip should be presented to the user right away.<br>
The UI should then show a list of suggested folder combinations. </p>
<p>Once configuration is finished, apps call <ahref="/method/messages.updateDialogFilter">messages.updateDialogFilter</a> to create or update existing folders.<br>
As per the <ahref="/constructor/dialogFilter">dialogFilter</a> constructor, folders have multiple flags that can be combined to determine which chats should be included in (or excluded from) the folder.<br>
Folders can also have up to <code>dialogs_folder_pinned_limit_*</code> pinned chats, as determined by the <ahref="/api/config#client-configuration">client configuration</a>.</p>
<p>To reorder existing folders, <ahref="/method/messages.updateDialogFiltersOrder">messages.updateDialogFiltersOrder</a> should be used with the IDs of the various dialog filters.</p>
<p>Premium users also have access to a <ahref="/constructor/dialogFilterDefault">dialogFilterDefault</a> constructor, used only when reordering folders to indicate the default (all chats) folder. </p>
<p>To delete folders, use <ahref="/method/messages.updateDialogFilter">messages.updateDialogFilter</a> without populating the <code>filter</code> flag field. </p>
<p>Clients can receive <ahref="/constructor/updateDialogFilter">updateDialogFilter</a>, <ahref="/constructor/updateDialogFilterOrder">updateDialogFilterOrder</a> updates with new filter information, generated by other clients when modifying folder info.<br>
Clients can also receive <ahref="/constructor/updateDialogFilters">updateDialogFilters</a>, in which case folder info should be refetched manually using <ahref="/method/messages.getDialogFilters">messages.getDialogFilters</a>.</p>
<p>API peer folders are typically used only by <ahref="https://telegram.org/blog/archive-and-new-design">archived chats</a>, and are really handy for distinguishing groups of peers, since most peer-related constructors (updates, chat info) will contain the <code>folder_id</code> assigned the the specified chat. </p>
<p>In Telegram apps, API peer folders are used only to implement the chat archive, identified by <code>folder_id</code><code>1</code>; all other peers are in <code>folder_id</code><code>0</code> by default; no other <code>folder_id</code> is allowed at the moment.</p>
<ul>
<li><ahref="/method/folders.editPeerFolders">folders.editPeerFolders</a> can be used to add and remove peers from peer folders.</li>
<li><ahref="/method/folders.deleteFolder">folders.deleteFolder</a> can be used to delete peer folders, moving all peers previously present in that folder to the default <code>0</code> folder.</li>
</ul>
<p>Both methods return an <ahref="/constructor/updates">updates</a> constructor, containing a single <ahref="/constructor/updateFolderPeers">updateFolderPeers</a> with the new <code>folder_id</code> of moved peers.<br>
Clients can also receive <ahref="/constructor/updateFolderPeers">updateFolderPeers</a> as a normal <ahref="/api/updates">update</a>, generated by other clients when modifying peer folders.</p>
<p>Clients can then use <ahref="/type/InputDialogPeer">InputDialogPeer</a> to refer either to a specific chat, or to all chats in a peer folder: the server will return a <ahref="/type/DialogPeer">DialogPeer</a> in certain constructors for the same purpose. </p></div>