diff --git a/data/web/corefork.telegram.org/api/ringtones.html b/data/web/corefork.telegram.org/api/ringtones.html index 28eb794f3a..b9b7c92951 100644 --- a/data/web/corefork.telegram.org/api/ringtones.html +++ b/data/web/corefork.telegram.org/api/ringtones.html @@ -2,12 +2,12 @@ <html class=""> <head> <meta charset="utf-8"> - <title>Page not found</title> + <title>Ringtones</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta property="description" content=""> - <meta property="og:title" content="Page not found"> + <meta property="description" content="The API allows uploading and synchronizing notification sounds associated to a specific chat."> + <meta property="og:title" content="Ringtones"> <meta property="og:image" content=""> - <meta property="og:description" content=""> + <meta property="og:description" content="The API allows uploading and synchronizing notification sounds associated to a specific chat."> <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"> @@ -39,10 +39,54 @@ <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></li></ul></div> - <h1 id="dev_page_title">Page not found</h1> + <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/ringtones" >Ringtones</a></li></ul></div> + <h1 id="dev_page_title">Ringtones</h1> - <div id="dev_page_content">The page has not been saved</div> + <div id="dev_page_content"><!-- scroll_nav --> + +<p>The API allows uploading and synchronizing notification sounds associated to a specific chat.</p> +<h3><a class="anchor" name="uploading-notification-sounds" href="#uploading-notification-sounds"><i class="anchor-icon"></i></a>Uploading notification sounds</h3> +<p>Schema:</p> +<pre><code>inputPeerNotifySettings#df1f002b flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound = InputPeerNotifySettings; + +peerNotifySettings#a83b0426 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int ios_sound:flags.3?NotificationSound android_sound:flags.4?NotificationSound other_sound:flags.5?NotificationSound = PeerNotifySettings; + +account.savedRingtonesNotModified#fbf6e8b1 = account.SavedRingtones; +account.savedRingtones#c1e92cc5 hash:long ringtones:Vector<Document> = account.SavedRingtones; + +updateSavedRingtones#74d8be99 = Update; + +notificationSoundDefault#97e8bebe = NotificationSound; +notificationSoundNone#6f0c34df = NotificationSound; +notificationSoundLocal#830b9ae4 title:string data:string = NotificationSound; +notificationSoundRingtone#ff6c8049 id:long = NotificationSound; + +account.savedRingtone#b7263f6d = account.SavedRingtone; +account.savedRingtoneConverted#1f307eb7 document:Document = account.SavedRingtone; + +---functions--- + +account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones; +account.saveRingtone#3dea5b03 id:InputDocument unsave:Bool = account.SavedRingtone; +account.uploadRingtone#831a83a2 file:InputFile file_name:string mime_type:string = Document;</code></pre> +<p>A notification sound file may be uploaded using [account.uploadRingtone]</p> +<h3><a class="anchor" name="setting-notification-sounds" href="#setting-notification-sounds"><i class="anchor-icon"></i></a>Setting notification sounds</h3> +<p>Schema:</p> +<pre><code>notificationSoundDefault#97e8bebe = NotificationSound; +notificationSoundNone#6f0c34df = NotificationSound; +notificationSoundLocal#830b9ae4 title:string data:string = NotificationSound; +notificationSoundRingtone#ff6c8049 id:long = NotificationSound; + +inputPeerNotifySettings#df1f002b flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound = InputPeerNotifySettings; + +peerNotifySettings#a83b0426 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int ios_sound:flags.3?NotificationSound android_sound:flags.4?NotificationSound other_sound:flags.5?NotificationSound = PeerNotifySettings; + +updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; + +---functions--- + +account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool;</code></pre> +</div> </div> @@ -109,8 +153,11 @@ </div> </div> <script src="/js/main.js?46"></script> - - <script>backToTopInit("Go up"); + <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> diff --git a/data/web/corefork.telegram.org/api/web-events.html b/data/web/corefork.telegram.org/api/web-events.html index 90b7846c34..be3614e38b 100644 --- a/data/web/corefork.telegram.org/api/web-events.html +++ b/data/web/corefork.telegram.org/api/web-events.html @@ -47,7 +47,7 @@ <p>When interacting with HTML5 games and the websites of payment gateways, Telegram apps should expose APIs to allow receiving data and events from the websites.</p> <h3><a class="anchor" href="#event-apis" id="event-apis" name="event-apis"><i class="anchor-icon"></i></a>Event APIs</h3> <p>Games and payment gateways can generate events that are meant to be received by the Telegram apps. -Typically events are generated by using the <code>postEvent</code> method of the <a href="https://github.com/TelegramMessenger/GamingCommunication/blob/master/games.js">GamingCommunication library</a>. +Typically events are generated by using the <code>postEvent</code> method of the <a href="https://github.com/TelegramMessenger/GamingCommunication/blob/master/games.js">GamingCommunication library</a>, or by the <a href="/bots/webapps#initializing-web-apps">bot web apps library</a>.<br> The <code>postEvent</code> function will try sending the event to the Telegram app in a number of different ways.</p> <h4><a class="anchor" href="#webviewproxy" id="webviewproxy" name="webviewproxy"><i class="anchor-icon"></i></a>WebviewProxy</h4> <p>In mobile apps, the event receiver API should be typically exposed as a <code>window.TelegramWebviewProxy</code> object with a <code>postEvent</code> method.</p> @@ -57,7 +57,7 @@ The <code>postEvent</code> function will try sending the event to the Telegram a <pre><code>window.external.notify(JSON.stringify({eventType: eventType, eventData: eventData}));</code></pre> <h4><a class="anchor" href="#postmessage-api" id="postmessage-api" name="postmessage-api"><i class="anchor-icon"></i></a>postMessage API</h4> <p>Finally, web MTProto clients that need to open a game or process a payment in an iframe can use the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage">postMessage API</a> to receive events from iframes. -The <a href="https://github.com/TelegramMessenger/GamingCommunication/blob/master/games.js">GamingCommunication library</a> by default will use <code>'*'</code> as <code>targetOrigin</code>, sending messages to parent pages regardless of the origin of the embedder.</p> +The GamingCommunication and bot web app libraries by default will use <code>'*'</code> as <code>targetOrigin</code>, sending messages to parent pages regardless of the origin of the embedder.</p> <pre><code>window.parent.postMessage(JSON.stringify({eventType: eventType, eventData: eventData}), targetOrigin);</code></pre> <h4><a class="anchor" href="#event-types" id="event-types" name="event-types"><i class="anchor-icon"></i></a>Event types</h4> <p><code>eventType</code> is a simple string indicating the event type, and <code>eventData</code> is a payload with an object that will be parsed by the Telegram app.</p> @@ -71,9 +71,23 @@ The <a href="https://github.com/TelegramMessenger/GamingCommunication/blob/maste </thead> <tbody> <tr> +<td><code>web_app_close</code></td> +<td>null</td> +<td>Emitted by bot web apps when the web app webview should be closed.</td> +</tr> +<tr> +<td><code>web_app_phone_requested</code></td> +<td>null</td> +<td>Emitted by bot web apps when they request the user's phone number: Telegram clients should show a prompt to the user, which calls `window.Telegram.WebView.receiveEvent({})</td> +</tr> +<tr> +<td><code>web_app_open_popup</code></td> +<td>JSON object with <code>title</code> (optional string), <code>message</code> (string),</td> +</tr> +<tr> <td><code>payment_form_submit</code></td> -<td>JSON object with <code>data</code> and <code>title</code> fields</td> -<td><code>title</code> is the censored credit card title.<br><code>data</code> is a service-specific JSON payload with information about the payment credentials provided by the user to the payment system.<br><strong>Neither Telegram, nor bots will have access to your credit card information.</strong><br>Credit card details will be handled only by the payment system.</td> +<td>JSON object with <code>credentials</code> and <code>title</code> fields</td> +<td><code>title</code> is the censored credit card title.<br><code>credentials</code> is a service-specific JSON object with information about the payment credentials provided by the user to the payment system.<br><strong>Neither Telegram, nor bots will have access to your credit card information.</strong><br>Credit card details will be handled only by the payment system.</td> </tr> <tr> <td><code>share_score</code></td>