<metaproperty="description"content="The Saved Messages chat allows users to bookmark messages and media: it's a personal cloud storage for any messages or media you may want to send or forward there.">
<metaproperty="og:title"content="Saved messages">
<metaproperty="og:image"content="">
<metaproperty="og:description"content="The Saved Messages chat allows users to bookmark messages and media: it's a personal cloud storage for any messages or media you may want to send or forward there.">
<p>The Saved Messages chat allows users to bookmark messages and media: it's a personal cloud storage for any messages or media you may want to send or forward there. </p>
<p>Internally, the Saved Messages chat is simply the private chat with ourselves (i.e. the chat with <ahref="/constructor/inputPeerSelf">inputPeerSelf</a>): the only difference between the Saved Messages chat and a chat with any other user, is that additional features are available to better organize messages and media sent to it. </p>
<p>Messages sent and forwarded from various users (including ourselves) to Saved Messages are automatically categorized by their original dialog into a saved dialog list, quite similar to the normal dialog list used to normally interact with chats. </p>
<p>To add new dialogs to the normal dialog list a user has to write to them (or join a channel/chat, etc.).<br>
To add new dialogs to the saved dialog list, simply forward messages from any normal dialog to <ahref="/constructor/inputPeerSelf">inputPeerSelf</a> (the current user): the forwarded messages (including outgoing ones) will be added to a saved dialog with the same ID of the original dialog.</p>
<p>This includes outgoing messages, for example assume the following:</p>
<ul>
<li>Our user <code>id</code> is equal to <code>11111111</code></li>
<li>We send a message A with ID <code>10</code> to a <ahref="/api/channel">supergroup</a> with <code>id=-100122222222</code> (bot API format, equivalent to a <ahref="/constructor/peerChannel">peerChannel</a> with ID <code>122222222</code>) </li>
<li>Another user with <code>id=133333333</code> replies <code>B</code> to our previous message, message ID <code>11</code></li>
<li>We forward both messages <code>A</code> and <code>B</code> with IDs <code>10</code> and <code>11</code> to <ahref="/constructor/inputPeerSelf">inputPeerSelf</a>, which will:<ul>
<li>Create a new <ahref="/constructor/savedDialog">savedDialog</a> with <code>peer=-100122222222</code> (if it doesn't exist already because we already forwarded messages from that supergroup)</li>
<li>Generate two messages:<ul>
<li>Message <code>A</code>:<ul>
<li><code>id</code>: an unrelated message ID, the next one in the common ID sequence, for example <code>1234</code></li>
<p>Saving messages from private chats with users with forward privacy enabled will add them to a saved dialog entry of a special anonymous user with <code>id=2666000</code>. </p>
<p>Clients may use the following pseudocode to manually populate the <code>saved_peer_id</code> of old <code>layer < 170</code><ahref="/constructor/message">message</a>s stored in the <strong>local</strong> database. </p>
<pre><code>// user_id is the ID of the current user.
<p>Sending (not forwarding from another dialog) new messages directly to ourselves will add them to a saved dialog entry with ourselves. </p>
<p>A set of methods can then be used to obtain this dialog list, pin/unpin dialogs inside of it, view and remove messages from saved dialogs: <ahref="/method/messages.getSavedDialogs">messages.getSavedDialogs</a>, <ahref="/method/messages.getSavedHistory">messages.getSavedHistory</a>, <ahref="/method/messages.deleteSavedHistory">messages.deleteSavedHistory</a>, <ahref="/method/messages.getPinnedSavedDialogs">messages.getPinnedSavedDialogs</a>, <ahref="/method/messages.toggleSavedDialogPin">messages.toggleSavedDialogPin</a>, <ahref="/method/messages.reorderPinnedSavedDialogs">messages.reorderPinnedSavedDialogs</a> work just like their counterparts <ahref="/method/messages.getDialogs">messages.getDialogs</a>, <ahref="/method/messages.getHistory">messages.getHistory</a>, <ahref="/method/messages.deleteHistory">messages.deleteHistory</a>, <ahref="/method/messages.getPinnedDialogs">messages.getPinnedDialogs</a>, <ahref="/method/messages.toggleDialogPin">messages.toggleDialogPin</a>, <ahref="/method/messages.reorderPinnedDialogs">messages.reorderPinnedDialogs</a>, with the sole difference that they affect the saved dialog list, instead of the main dialog list. </p>
<p>To search for messages within a saved dialog, use the usual <ahref="/method/messages.search">messages.search</a>, <ahref="/method/messages.getSearchCounters">messages.getSearchCounters</a>, <ahref="/method/messages.getSearchResultsCalendar">messages.getSearchResultsCalendar</a>, <ahref="/method/messages.getSearchResultsPositions">messages.getSearchResultsPositions</a> methods with <code>peer</code>=<ahref="/constructor/inputPeerSelf">inputPeerSelf</a> and <code>saved_peer_id</code>=id of the saved dialog.</p></div>
</div>
</div>
</div>
<divclass="footer_wrap">
<divclass="footer_columns_wrap footer_desktop">
<divclass="footer_column footer_column_telegram">
<h5>Telegram</h5>
<divclass="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.