telegram-crawler/data/web/core.telegram.org/api/wallpapers.html
2024-08-02 00:44:36 +00:00

256 lines
30 KiB
HTML

<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Wallpapers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram apps support generating, sharing and synchronizing chat backgrounds.">
<meta property="og:title" content="Wallpapers">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram apps support generating, sharing and synchronizing chat backgrounds.">
<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?240" 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/wallpapers" >Wallpapers</a></li></ul></div>
<h1 id="dev_page_title">Wallpapers</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram apps support generating, sharing and synchronizing chat backgrounds.</p>
<p>Wallpapers must be rendered according to the instructions contained in the wallpaper constructors. </p>
<h3><a class="anchor" href="#wallpaper-types" id="wallpaper-types" name="wallpaper-types"><i class="anchor-icon"></i></a>Wallpaper types</h3>
<p>There are four main wallpaper types:</p>
<ul>
<li><a href="#image-wallpapers">Image wallpapers</a></li>
<li><a href="#pattern-wallpapers">Pattern wallpapers</a></li>
<li><a href="#fill-wallpapers">Fill wallpapers</a></li>
<li><a href="#channel-wallpapers">Channel wallpapers</a></li>
</ul>
<p>Fill and pattern wallpapers are generated using one of three <a href="#fill-types">fill types</a>.</p>
<h4><a class="anchor" href="#image-wallpapers" id="image-wallpapers" name="image-wallpapers"><i class="anchor-icon"></i></a>Image wallpapers</h4>
<pre><code><a href='/constructor/wallPaper'>wallPaper</a>#a437c3ed id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> pattern:flags.3?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> document:<a href='/type/Document'>Document</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;
<a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>Image wallpapers are wallpapers described by a <a href="/constructor/wallPaperNoFile">wallPaper</a> constructor, containing a JPEG image in the <code>document</code> field.<br>
The <code>settings</code> field describes the transforms that should be applied to the image if the corresponding flags are set: </p>
<ul>
<li><code>settings.blur</code>: The image should be downscaled to fit in 450x450 square and then box-blurred with radius 12.</li>
<li><code>settings.motion</code>: The image needs to be slightly moved when device is tilted, allowing for a parallax effect.</li>
</ul>
<p>All other <code>settings</code> flags should be ignored. </p>
<h4><a class="anchor" href="#pattern-wallpapers" id="pattern-wallpapers" name="pattern-wallpapers"><i class="anchor-icon"></i></a>Pattern wallpapers</h4>
<pre><code><a href='/constructor/wallPaper'>wallPaper</a>#a437c3ed id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> pattern:flags.3?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> document:<a href='/type/Document'>Document</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;
<a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>Pattern wallpapers are wallpapers described by a <a href="/constructor/wallPaperNoFile">wallPaper</a> constructor with the <code>pattern</code> flag set, combining the <a href="#fill-types">color fill</a> specified by the <code>settings</code> field with the PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern image contained in the <code>document</code> field. </p>
<p>The pattern image should be completely transparent, except for the pattern itself which should be shades of black.</p>
<p>The following flags in the <code>settings</code> field describe how should the pattern be combined with the color fill:</p>
<ul>
<li><code>settings.intensity</code>: A value ranging from -100 to 100.<ul>
<li>Values from 0 to 100 mean that the pattern should be overlaid on top of the <a href="#fill-types">color fill</a> with the specified intensity (@ 100 the black pattern is fully visible on the background fill, @ 0 only the background fill is visible). </li>
<li>Values from -1 to -100 mean that the pattern should be inverted (black background, transparent pattern) before overlaying on top of the <a href="#fill-types">color fill</a> with the specified intensity (@ -100 the filled pattern is fully visible on a black background, @ -1 only black is visible). </li>
</ul>
</li>
<li><code>settings.motion</code>: The pattern needs to be slightly moved on top of the background when device is tilted, allowing for a parallax effect.</li>
</ul>
<h4><a class="anchor" href="#fill-wallpapers" id="fill-wallpapers" name="fill-wallpapers"><i class="anchor-icon"></i></a>Fill wallpapers</h4>
<pre><code><a href='/constructor/wallPaperNoFile'>wallPaperNoFile</a>#e0804116 id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> default:flags.1?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;</code></pre>
<p>Fill wallpapers are simple wallpapers described by the <a href="/constructor/wallPaperNoFile">wallPaperNoFile</a> constructor, containing only the <a href="#fill-types">fill</a> specified by the <code>settings</code> field. </p>
<h4><a class="anchor" href="#channel-wallpapers" id="channel-wallpapers" name="channel-wallpapers"><i class="anchor-icon"></i></a>Channel wallpapers</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p><a href="#fill-wallpapers">Fill wallpapers</a> with an <code>emoticon</code> contained in the associated wallpaper <code>settings</code> indicate a channel wallpaper, that can be <a href="#installing-wallpapers-in-a-specific-chat-or-channel">installed »</a> in channels that have enough boosts, <a href="#installing-wallpapers-in-a-specific-chat-or-channel">see here »</a> for more info. </p>
<p>The full list of channel wallpapers can be fetched using <a href="/method/account.getChatThemes">account.getChatThemes</a>. </p>
<p>Channels may also set any custom wallpaper (not just the ones returned by <a href="/method/account.getChatThemes">account.getChatThemes</a>) after reaching a higher boost level, <a href="#installing-wallpapers-in-a-specific-chat-or-channel">see here »</a> for more info. </p>
<h3><a class="anchor" href="#fill-types" id="fill-types" name="fill-types"><i class="anchor-icon"></i></a>Fill types</h3>
<p>Fill and pattern wallpapers are generated using one of three fill types: </p>
<ul>
<li><a href="#solid-fill">Solid fill</a></li>
<li><a href="#gradient-fill">Gradient fill</a></li>
<li><a href="#freeform-gradient-fill">Freeform gradient fill</a></li>
</ul>
<h4><a class="anchor" href="#solid-fill" id="solid-fill" name="solid-fill"><i class="anchor-icon"></i></a>Solid fill</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>If out of the <code>*_background_color</code> flags only <code>background_color</code> is set, the fill is made of just the specified RGB-24 color.</p>
<h4><a class="anchor" href="#gradient-fill" id="gradient-fill" name="gradient-fill"><i class="anchor-icon"></i></a>Gradient fill</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>If out of the <code>*_background_color</code> flags only <code>background_color</code> and <code>second_background_color</code> are set, the fill is made of a top-bottom (background-second_background) gradient of the specified RGB-24 colors.<br>
If set, <code>rotation</code> indicates clockwise rotation angle of the gradient, in degrees; 0-359. Must be always divisible by 45, default to 0 if not set. </p>
<h4><a class="anchor" href="#freeform-gradient-fill" id="freeform-gradient-fill" name="freeform-gradient-fill"><i class="anchor-icon"></i></a>Freeform gradient fill</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>If the <code>background_color</code>, <code>second_background_color</code>, <code>third_background_color</code> and optionally <code>fourth_background_color</code> flags are set, the fill is made of a freeform gradient of the specified 3 or 4 RGB-24 colors. </p>
<h3><a class="anchor" href="#wallpaper-api" id="wallpaper-api" name="wallpaper-api"><i class="anchor-icon"></i></a>Wallpaper API</h3>
<h4><a class="anchor" href="#uploading-wallpapers" id="uploading-wallpapers" name="uploading-wallpapers"><i class="anchor-icon"></i></a>Uploading wallpapers</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;
<a href='/constructor/wallPaper'>wallPaper</a>#a437c3ed id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> pattern:flags.3?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> document:<a href='/type/Document'>Document</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;
---functions---
<a href='/method/account.uploadWallPaper'>account.uploadWallPaper</a>#e39a8f03 flags:<a href='/type/%23'>#</a> for_chat:flags.0?<a href='/constructor/true'>true</a> file:<a href='/type/InputFile'>InputFile</a> mime_type:<a href='/type/string'>string</a> settings:<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;</code></pre>
<p><a href="/method/account.uploadWallPaper">account.uploadWallPaper</a> is used to upload <a href="#image-wallpapers">image</a> and <a href="#pattern-wallpapers">pattern</a> wallpapers. The <code>for_chat</code> flag must be set when uploading wallpapers to be used with <a href="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>.<br>
<a href="#fill-wallpapers">Fill wallpapers</a> don't require uploading since they have no associated file, and a <a href="/constructor/wallPaper">wallPaper</a> constructor can directly be generated client-side, specifying <code>id=0</code>. </p>
<p>Wallpapers can then be shared using a <a href="/api/links#wallpaper-links">wallpaper deep link »</a>, and/or <a href="#installing-wallpapers">installed as specified here (image and pattern wallpapers only) »</a>. </p>
<h4><a class="anchor" href="#installing-wallpapers" id="installing-wallpapers" name="installing-wallpapers"><i class="anchor-icon"></i></a>Installing wallpapers</h4>
<pre><code><a href='/constructor/inputWallPaper'>inputWallPaper</a>#e630b979 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputWallPaper'>InputWallPaper</a>;
<a href='/constructor/inputWallPaperSlug'>inputWallPaperSlug</a>#72091c80 slug:<a href='/type/string'>string</a> = <a href='/type/InputWallPaper'>InputWallPaper</a>;
<a href='/constructor/wallPaper'>wallPaper</a>#a437c3ed id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> pattern:flags.3?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> document:<a href='/type/Document'>Document</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;
<a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;
<a href='/constructor/account.wallPapersNotModified'>account.wallPapersNotModified</a>#1c199183 = <a href='/type/account.WallPapers'>account.WallPapers</a>;
<a href='/constructor/account.wallPapers'>account.wallPapers</a>#cdc3858c hash:<a href='/type/long'>long</a> wallpapers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/WallPaper'>WallPaper</a>&gt; = <a href='/type/account.WallPapers'>account.WallPapers</a>;
---functions---
<a href='/method/account.getWallPaper'>account.getWallPaper</a>#fc8ddbea wallpaper:<a href='/type/InputWallPaper'>InputWallPaper</a> = <a href='/type/WallPaper'>WallPaper</a>;
<a href='/method/account.getMultiWallPapers'>account.getMultiWallPapers</a>#65ad71dc wallpapers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputWallPaper'>InputWallPaper</a>&gt; = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/WallPaper'>WallPaper</a>&gt;;
<a href='/method/account.saveWallPaper'>account.saveWallPaper</a>#6c5a5b37 wallpaper:<a href='/type/InputWallPaper'>InputWallPaper</a> unsave:<a href='/type/Bool'>Bool</a> settings:<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/account.installWallPaper'>account.installWallPaper</a>#feed5769 wallpaper:<a href='/type/InputWallPaper'>InputWallPaper</a> settings:<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/account.getWallPapers'>account.getWallPapers</a>#7967d36 hash:<a href='/type/long'>long</a> = <a href='/type/account.WallPapers'>account.WallPapers</a>;
<a href='/method/account.resetWallPapers'>account.resetWallPapers</a>#bb3b9804 = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Once you've <a href="#uploading-wallpapers">uploaded your wallpaper</a> or received a <a href="/api/links#wallpaper-links">wallpaper deep link</a>, it can be installed as follows. </p>
<p><em>Note that <a href="#fill-wallpapers">fill wallpapers</a> cannot be globally installed using <a href="/method/account.installWallPaper">account.installWallPaper</a> or <a href="/method/account.saveWallPaper">account.saveWallPaper</a>, clients should install and keep track of them only locally, without synchronizing the wallpaper list or signaling installations.</em></p>
<p>The API keeps a list of wallpapers that the user can set as chat background, including some preinstalled ones.<br>
To fetch the list use <a href="/method/account.getWallPapers">account.getWallPapers</a>.<br>
To save a wallpaper to the list use <a href="/method/account.saveWallPaper">account.saveWallPaper</a> with <code>unsave=false</code>.<br>
To remove a wallpaper (including preinstalled wallpapers) from the list use <a href="/method/account.saveWallPaper">account.saveWallPaper</a> with <code>unsave=true</code>.<br>
To restore the default list, removing all installed wallpapers and reinstalling previously removed preinstalled wallpapers use <a href="/method/account.resetWallPapers">account.resetWallPapers</a>. </p>
<p>When a client sets a wallpaper as the default chat background, call <a href="/method/account.installWallPaper">account.installWallPaper</a> to signal this installation to the server.<br>
Note that calling this method will also automatically save the wallpaper, if it's not present in the saved wallpapers list. </p>
<p>In all cases where an <a href="/type/InputWallPaper">InputWallPaper</a> constructor is required, pass: </p>
<ul>
<li><a href="/constructor/inputWallPaperSlug">inputWallPaperSlug</a> when working with <a href="/api/links#wallpaper-links">wallpaper deep links</a>.</li>
<li><a href="/constructor/inputWallPaper">inputWallPaper</a> otherwise, using the ID and access hash fields of a full <a href="/constructor/wallPaper">wallPaper</a>.<br>
As mentioned earlier, <a href="#fill-wallpapers">fill wallpapers</a> can't be saved to the server using <a href="/method/account.installWallPaper">account.installWallPaper</a> or <a href="/method/account.saveWallPaper">account.saveWallPaper</a>: an <a href="/constructor/inputWallPaperNoFile">inputWallPaperNoFile</a> is available for fill wallpapers but can <strong>only</strong> be used when working with <a href="/api/themes">themes »</a> or when using <a href="/method/messages.setChatWallPaper">messages.setChatWallPaper</a> as follows.</li>
</ul>
<h4><a class="anchor" href="#installing-wallpapers-in-a-specific-chat-or-channel" id="installing-wallpapers-in-a-specific-chat-or-channel" name="installing-wallpapers-in-a-specific-chat-or-channel"><i class="anchor-icon"></i></a>Installing wallpapers in a specific chat or channel</h4>
<pre><code><a href='/constructor/messageActionSetChatWallPaper'>messageActionSetChatWallPaper</a>#5060a3f4 flags:<a href='/type/%23'>#</a> same:flags.0?<a href='/constructor/true'>true</a> for_both:flags.1?<a href='/constructor/true'>true</a> wallpaper:<a href='/type/WallPaper'>WallPaper</a> = <a href='/type/MessageAction'>MessageAction</a>;
<a href='/constructor/updatePeerWallpaper'>updatePeerWallpaper</a>#ae3f101d flags:<a href='/type/%23'>#</a> wallpaper_overridden:flags.1?<a href='/constructor/true'>true</a> peer:<a href='/type/Peer'>Peer</a> wallpaper:flags.0?<a href='/type/WallPaper'>WallPaper</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/messages.setChatWallPaper'>messages.setChatWallPaper</a>#8ffacae1 flags:<a href='/type/%23'>#</a> for_both:flags.3?<a href='/constructor/true'>true</a> revert:flags.4?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> wallpaper:flags.0?<a href='/type/InputWallPaper'>InputWallPaper</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> id:flags.1?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Wallpapers can also be installed in a specific private chat, by using <a href="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>: this will emit a <a href="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a> service message, displaying the wallpaper in the UI along with an invitation for the other user to apply the same wallpaper. </p>
<p>To <code>wallpaper</code>, pass an: </p>
<ul>
<li><a href="/constructor/inputWallPaperSlug">inputWallPaperSlug</a> when working with <a href="/api/links#wallpaper-links">wallpaper deep links</a>.</li>
<li><a href="/constructor/inputWallPaperNoFile">inputWallPaperNoFile</a> for <a href="#fill-wallpapers">fill wallpapers</a>. </li>
<li><a href="/constructor/inputWallPaper">inputWallPaper</a> otherwise, using the ID and access hash fields of a full <a href="/constructor/wallPaper">wallPaper</a>. </li>
</ul>
<p>If the other user decides to apply the same wallpaper to the chat, <a href="/method/messages.setChatWallPaper">messages.setChatWallPaper</a> should be invoked passing the wallpaper <code>settings</code> received in the <a href="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a> service message (or some different settings, if the user customized them before applying the wallpaper), along with the <code>id</code> of the <a href="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a> service message, <strong>without</strong> the <code>wallpaper</code>: this way, the action will emit a <a href="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a> <strong>with the <code>same</code> flag set</strong>, which should be displayed in the UI as a simple acknowledgment service message, without the full wallpaper and without an invitation for the other user to apply it (since both participants already just did that). </p>
<p>However, if we have <a href="/api/premium">Premium</a> subscription, we can change the other user's wallpaper without explicit confirmation from the other side: to do so, set the <code>for_both</code> flag when invoking <a href="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>.<br>
This will change the wallpaper for both sides of the chat, without requiring confirmation; the <a href="/constructor/userFull">userFull</a>.<code>wallpaper_overridden</code> flag will also be set for the other user; the action will also emit a <a href="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a> <strong>with the <code>for_both</code> flag set</strong>.<br>
If the other user does not like the new wallpaper we have chosen for them, they can re-set their previous wallpaper just on their side, by invoking <a href="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>, providing only the <code>revert</code> flag (and obviously the <code>peer</code> parameter). </p>
<p>Note that in order to pass <a href="#image-wallpapers">image</a> or <a href="#pattern-wallpapers">pattern</a> wallpapers to <a href="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>, the <code>for_chat</code> flag must be set when <a href="#uploading-wallpapers">uploading them with account.uploadWallPaper</a>. </p>
<p>Also note that unlike <a href="/method/account.installWallPaper">account.installWallPaper</a> or <a href="/method/account.saveWallPaper">account.saveWallPaper</a>, <a href="/method/messages.setChatWallPaper">messages.setChatWallPaper</a> accepts <a href="#fill-wallpapers">fill wallpapers</a> as well.</p>
<p>Wallpaper changes will also emit an <a href="/constructor/updatePeerWallpaper">updatePeerWallpaper</a> update.</p>
<p>After reaching at least the <a href="/api/boost">boost level</a> specified in the <a href="/api/config#channel-wallpaper-level-min"><code>channel_wallpaper_level_min</code> config parameter</a>, channels gain the ability to set one of the <a href="#channel-wallpapers">fill channel wallpapers returned by account.getChatThemes (see » for more info)</a>. </p>
<p>After reaching at least the boost level specified in the <a href="/api/config#channel-custom-wallpaper-level-min"><code>channel_custom_wallpaper_level_min</code> config parameter</a>, channels gain the ability to set any custom <a href="/api/wallpapers">wallpaper</a>, not just fill channel wallpapers. </p>
<p>When setting channel wallpapers, do <strong>not</strong> set the <code>for_both</code> flag.</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>