mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-11-29 11:43:05 +01:00
206 lines
20 KiB
HTML
206 lines
20 KiB
HTML
<!DOCTYPE html>
|
|
<html class="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Saved messages</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta property="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.">
|
|
<meta property="og:title" content="Saved messages">
|
|
<meta property="og:image" content="">
|
|
<meta property="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.">
|
|
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
|
|
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
|
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
|
|
|
<link href="/css/telegram.css?236" rel="stylesheet" media="screen">
|
|
<style>
|
|
</style>
|
|
</head>
|
|
<body class="preload">
|
|
<div class="dev_page_wrap">
|
|
<div class="dev_page_head navbar navbar-static-top navbar-tg">
|
|
<div class="navbar-inner">
|
|
<div class="container clearfix">
|
|
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
|
|
<ul class="nav navbar-nav">
|
|
<li><a href="//telegram.org/">Home</a></li>
|
|
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
|
|
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
|
|
<li class="active"><a href="/api">API</a></li>
|
|
<li class=""><a href="/mtproto">Protocol</a></li>
|
|
<li class=""><a href="/schema">Schema</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="container clearfix">
|
|
<div class="dev_page">
|
|
<div id="dev_page_content_wrap" class=" ">
|
|
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/saved-messages" >Saved messages</a></li></ul></div>
|
|
<h1 id="dev_page_title">Saved messages</h1>
|
|
|
|
<div id="dev_page_content"><!-- scroll_nav -->
|
|
|
|
<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 <a href="/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>Schema:</p>
|
|
<pre><code><a href='/constructor/message'>message</a>#76bec211 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> invert_media:flags.27?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> saved_peer_id:flags.28?<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a><<a href='/type/MessageEntity'>MessageEntity</a>> views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a><<a href='/type/RestrictionReason'>RestrictionReason</a>> ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
|
|
<a href='/constructor/messageFwdHeader'>messageFwdHeader</a>#4e4df4bb flags:<a href='/type/%23'>#</a> imported:flags.7?<a href='/constructor/true'>true</a> saved_out:flags.11?<a href='/constructor/true'>true</a> from_id:flags.0?<a href='/type/Peer'>Peer</a> from_name:flags.5?<a href='/type/string'>string</a> date:<a href='/type/int'>int</a> channel_post:flags.2?<a href='/type/int'>int</a> post_author:flags.3?<a href='/type/string'>string</a> saved_from_peer:flags.4?<a href='/type/Peer'>Peer</a> saved_from_msg_id:flags.4?<a href='/type/int'>int</a> saved_from_id:flags.8?<a href='/type/Peer'>Peer</a> saved_from_name:flags.9?<a href='/type/string'>string</a> saved_date:flags.10?<a href='/type/int'>int</a> psa_type:flags.6?<a href='/type/string'>string</a> = <a href='/type/MessageFwdHeader'>MessageFwdHeader</a>;
|
|
|
|
<a href='/constructor/savedDialog'>savedDialog</a>#bd87cb6c flags:<a href='/type/%23'>#</a> pinned:flags.2?<a href='/constructor/true'>true</a> peer:<a href='/type/Peer'>Peer</a> top_message:<a href='/type/int'>int</a> = <a href='/type/SavedDialog'>SavedDialog</a>;
|
|
|
|
<a href='/constructor/updateSavedDialogPinned'>updateSavedDialogPinned</a>#aeaf9e74 flags:<a href='/type/%23'>#</a> pinned:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/DialogPeer'>DialogPeer</a> = <a href='/type/Update'>Update</a>;
|
|
<a href='/constructor/updatePinnedSavedDialogs'>updatePinnedSavedDialogs</a>#686c85a6 flags:<a href='/type/%23'>#</a> order:flags.0?<a href='/type/Vector%20t'>Vector</a><<a href='/type/DialogPeer'>DialogPeer</a>> = <a href='/type/Update'>Update</a>;
|
|
|
|
<a href='/constructor/messages.savedDialogs'>messages.savedDialogs</a>#f83ae221 dialogs:<a href='/type/Vector%20t'>Vector</a><<a href='/type/SavedDialog'>SavedDialog</a>> messages:<a href='/type/Vector%20t'>Vector</a><<a href='/type/Message'>Message</a>> chats:<a href='/type/Vector%20t'>Vector</a><<a href='/type/Chat'>Chat</a>> users:<a href='/type/Vector%20t'>Vector</a><<a href='/type/User'>User</a>> = <a href='/type/messages.SavedDialogs'>messages.SavedDialogs</a>;
|
|
<a href='/constructor/messages.savedDialogsSlice'>messages.savedDialogsSlice</a>#44ba9dd9 count:<a href='/type/int'>int</a> dialogs:<a href='/type/Vector%20t'>Vector</a><<a href='/type/SavedDialog'>SavedDialog</a>> messages:<a href='/type/Vector%20t'>Vector</a><<a href='/type/Message'>Message</a>> chats:<a href='/type/Vector%20t'>Vector</a><<a href='/type/Chat'>Chat</a>> users:<a href='/type/Vector%20t'>Vector</a><<a href='/type/User'>User</a>> = <a href='/type/messages.SavedDialogs'>messages.SavedDialogs</a>;
|
|
<a href='/constructor/messages.savedDialogsNotModified'>messages.savedDialogsNotModified</a>#c01f6fe8 count:<a href='/type/int'>int</a> = <a href='/type/messages.SavedDialogs'>messages.SavedDialogs</a>;
|
|
|
|
<a href='/constructor/savedDialog'>savedDialog</a>#bd87cb6c flags:<a href='/type/%23'>#</a> pinned:flags.2?<a href='/constructor/true'>true</a> peer:<a href='/type/Peer'>Peer</a> top_message:<a href='/type/int'>int</a> = <a href='/type/SavedDialog'>SavedDialog</a>;
|
|
|
|
---functions---
|
|
|
|
<a href='/method/messages.getSavedDialogs'>messages.getSavedDialogs</a>#5381d21a flags:<a href='/type/%23'>#</a> exclude_pinned:flags.0?<a href='/constructor/true'>true</a> offset_date:<a href='/type/int'>int</a> offset_id:<a href='/type/int'>int</a> offset_peer:<a href='/type/InputPeer'>InputPeer</a> limit:<a href='/type/int'>int</a> hash:<a href='/type/long'>long</a> = <a href='/type/messages.SavedDialogs'>messages.SavedDialogs</a>;
|
|
<a href='/method/messages.getSavedHistory'>messages.getSavedHistory</a>#3d9a414d peer:<a href='/type/InputPeer'>InputPeer</a> offset_id:<a href='/type/int'>int</a> offset_date:<a href='/type/int'>int</a> add_offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> max_id:<a href='/type/int'>int</a> min_id:<a href='/type/int'>int</a> hash:<a href='/type/long'>long</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
|
|
<a href='/method/messages.deleteSavedHistory'>messages.deleteSavedHistory</a>#6e98102b flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> max_id:<a href='/type/int'>int</a> min_date:flags.2?<a href='/type/int'>int</a> max_date:flags.3?<a href='/type/int'>int</a> = <a href='/type/messages.AffectedHistory'>messages.AffectedHistory</a>;
|
|
<a href='/method/messages.getPinnedSavedDialogs'>messages.getPinnedSavedDialogs</a>#d63d94e0 = <a href='/type/messages.SavedDialogs'>messages.SavedDialogs</a>;
|
|
<a href='/method/messages.toggleSavedDialogPin'>messages.toggleSavedDialogPin</a>#ac81bbde flags:<a href='/type/%23'>#</a> pinned:flags.0?<a href='/constructor/true'>true</a> peer:<a href='/type/InputDialogPeer'>InputDialogPeer</a> = <a href='/type/Bool'>Bool</a>;
|
|
<a href='/method/messages.reorderPinnedSavedDialogs'>messages.reorderPinnedSavedDialogs</a>#8b716587 flags:<a href='/type/%23'>#</a> force:flags.0?<a href='/constructor/true'>true</a> order:<a href='/type/Vector%20t'>Vector</a><<a href='/type/InputDialogPeer'>InputDialogPeer</a>> = <a href='/type/Bool'>Bool</a>;
|
|
|
|
|
|
<a href='/method/messages.search'>messages.search</a>#a7b4e929 flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> q:<a href='/type/string'>string</a> from_id:flags.0?<a href='/type/InputPeer'>InputPeer</a> saved_peer_id:flags.2?<a href='/type/InputPeer'>InputPeer</a> top_msg_id:flags.1?<a href='/type/int'>int</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> min_date:<a href='/type/int'>int</a> max_date:<a href='/type/int'>int</a> offset_id:<a href='/type/int'>int</a> add_offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> max_id:<a href='/type/int'>int</a> min_id:<a href='/type/int'>int</a> hash:<a href='/type/long'>long</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
|
|
<a href='/method/messages.getSearchCounters'>messages.getSearchCounters</a>#1bbcf300 flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> saved_peer_id:flags.2?<a href='/type/InputPeer'>InputPeer</a> top_msg_id:flags.0?<a href='/type/int'>int</a> filters:<a href='/type/Vector%20t'>Vector</a><<a href='/type/MessagesFilter'>MessagesFilter</a>> = <a href='/type/Vector%20t'>Vector</a><<a href='/type/messages.SearchCounter'>messages.SearchCounter</a>>;
|
|
<a href='/method/messages.getSearchResultsCalendar'>messages.getSearchResultsCalendar</a>#6aa3f6bd flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> saved_peer_id:flags.2?<a href='/type/InputPeer'>InputPeer</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> offset_id:<a href='/type/int'>int</a> offset_date:<a href='/type/int'>int</a> = <a href='/type/messages.SearchResultsCalendar'>messages.SearchResultsCalendar</a>;
|
|
<a href='/method/messages.getSearchResultsPositions'>messages.getSearchResultsPositions</a>#9c7f2f10 flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> saved_peer_id:flags.2?<a href='/type/InputPeer'>InputPeer</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> offset_id:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.SearchResultsPositions'>messages.SearchResultsPositions</a>;</code></pre>
|
|
<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 <a href="/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 <a href="/api/channel">supergroup</a> with <code>id=-100122222222</code> (bot API format, equivalent to a <a href="/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 <a href="/constructor/inputPeerSelf">inputPeerSelf</a>, which will:<ul>
|
|
<li>Create a new <a href="/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>
|
|
<li><code>peer_id</code>: <code>11111111</code></li>
|
|
<li><code>saved_peer_id</code>: <code>-100122222222</code></li>
|
|
<li><code>fwd_from.from_id</code>: <code>11111111</code></li>
|
|
<li><code>fwd_from.saved_from_peer</code>: <code>-100122222222</code></li>
|
|
<li><code>fwd_from.saved_from_msg_id</code>: <code>10</code></li>
|
|
</ul>
|
|
</li>
|
|
<li>Message <code>B</code>:<ul>
|
|
<li><code>id</code>: an unrelated message ID, the next one in the common ID sequence, for example <code>1235</code></li>
|
|
<li><code>reply_to.reply_to_msg_id</code>: <code>1234</code></li>
|
|
<li><code>peer_id</code>: <code>11111111</code></li>
|
|
<li><code>saved_peer_id</code>: <code>-100122222222</code></li>
|
|
<li><code>fwd_from.from_id</code>: <code>133333333</code></li>
|
|
<li><code>fwd_from.saved_from_peer</code>: <code>-100122222222</code></li>
|
|
<li><code>fwd_from.saved_from_msg_id</code>: <code>11</code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<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> <a href="/constructor/message">message</a>s stored in the <strong>local</strong> database. </p>
|
|
<pre><code>// user_id is the ID of the current user.
|
|
|
|
if (message.peer_id == user_id) {
|
|
if (message.fwd_from.saved_from_peer) {
|
|
message.saved_peer_id = message.fwd_from.saved_from_peer
|
|
} elseif (message.fwd_from.from_id) {
|
|
message.saved_peer_id = user_id;
|
|
} elseif (message.fwd_from.from_name) {
|
|
message.saved_peer_id = 2666000;
|
|
} else {
|
|
message.saved_peer_id = user_id;
|
|
}
|
|
}</code></pre>
|
|
<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: <a href="/method/messages.getSavedDialogs">messages.getSavedDialogs</a>, <a href="/method/messages.getSavedHistory">messages.getSavedHistory</a>, <a href="/method/messages.deleteSavedHistory">messages.deleteSavedHistory</a>, <a href="/method/messages.getPinnedSavedDialogs">messages.getPinnedSavedDialogs</a>, <a href="/method/messages.toggleSavedDialogPin">messages.toggleSavedDialogPin</a>, <a href="/method/messages.reorderPinnedSavedDialogs">messages.reorderPinnedSavedDialogs</a> work just like their counterparts <a href="/method/messages.getDialogs">messages.getDialogs</a>, <a href="/method/messages.getHistory">messages.getHistory</a>, <a href="/method/messages.deleteHistory">messages.deleteHistory</a>, <a href="/method/messages.getPinnedDialogs">messages.getPinnedDialogs</a>, <a href="/method/messages.toggleDialogPin">messages.toggleDialogPin</a>, <a href="/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 <a href="/method/messages.search">messages.search</a>, <a href="/method/messages.getSearchCounters">messages.getSearchCounters</a>, <a href="/method/messages.getSearchResultsCalendar">messages.getSearchResultsCalendar</a>, <a href="/method/messages.getSearchResultsPositions">messages.getSearchResultsPositions</a> methods with <code>peer</code>=<a href="/constructor/inputPeerSelf">inputPeerSelf</a> and <code>saved_peer_id</code>=id of the saved dialog.</p></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="footer_wrap">
|
|
<div class="footer_columns_wrap footer_desktop">
|
|
<div class="footer_column footer_column_telegram">
|
|
<h5>Telegram</h5>
|
|
<div class="footer_telegram_description"></div>
|
|
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
|
|
</div>
|
|
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/faq">About</a></h5>
|
|
<ul>
|
|
<li><a href="//telegram.org/faq">FAQ</a></li>
|
|
<li><a href="//telegram.org/privacy">Privacy</a></li>
|
|
<li><a href="//telegram.org/press">Press</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
|
|
<ul>
|
|
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
|
|
<li><a href="//telegram.org/android">Android</a></li>
|
|
<li><a href="//telegram.org/dl/web">Mobile Web</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
|
|
<ul>
|
|
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
|
|
<li><a href="//macos.telegram.org/">macOS</a></li>
|
|
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer_column footer_column_platform">
|
|
<h5><a href="/">Platform</a></h5>
|
|
<ul>
|
|
<li><a href="/api">API</a></li>
|
|
<li><a href="//translations.telegram.org/">Translations</a></li>
|
|
<li><a href="//instantview.telegram.org/">Instant View</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="footer_columns_wrap footer_mobile">
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/faq">About</a></h5>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/blog">Blog</a></h5>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/apps">Apps</a></h5>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="/">Platform</a></h5>
|
|
</div>
|
|
<div class="footer_column">
|
|
<h5><a href="//telegram.org/press">Press</a></h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="/js/main.js?47"></script>
|
|
<script src="/js/jquery.min.js?1"></script>
|
|
<script src="/js/bootstrap.min.js?1"></script>
|
|
|
|
<script>window.initDevPageNav&&initDevPageNav();
|
|
backToTopInit("Go up");
|
|
removePreloadInit();
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|