Someone sent you three lines instead of a link. The first looks like a website address or a few numbers with dots, the second is a number, and the third is a long string of letters and digits, as if a cat had walked across the keyboard. Or there was a link, but it didn't open, and someone told you to "just enter it manually". So you open Telegram settings, see the fields Server, Port and Secret, and can't tell which line goes where.
Let me say right away that we sell proxies ourselves, so keep that in mind. The field labels below are taken from the English strings of the Telegram apps, and the way the fields behave was checked against the source code of Telegram Desktop and Telegram for Android.
What Telegram does with these three lines
A proxy server sits between Telegram and the network, and the app connects not directly but through that computer. The three fields tell Telegram where that computer is and how to say hello to it.
The Server field takes the address of that computer, either an IP made of numbers with dots or a name like proxy.example.com, with no https:// in front. In Telegram Desktop this field is labelled Hostname, in the other apps it's Server. The port tells Telegram which door on that server to knock on. It's a number up to 65535, and Telegram's guide for server owners uses 443 in its example, the same number that ordinary HTTPS websites use.
The third line is trickier, and nearly all the confusion comes from it. Only an MTProto proxy needs a secret. A SOCKS5 proxy has none, and instead it may have Username and Password fields. The secret is created by the server owner: according to the MTProxy instructions, they take 16 random bytes, write them out as 32 characters and start the server with exactly that secret. That's why the server won't let you in without the secret, and a secret that one owner set for their server won't work on someone else's, even though all secrets look alike. In the English interface the field is called Secret everywhere, on the phone and on the computer.
There's no Telegram login, phone number or login code in these fields. Telegram asks you never to share your login code with anyone, so if someone asks for your code along with the address, that has nothing to do with the proxy. The sponsored channel that sometimes shows up in your chat list isn't hidden in the secret either, because the server owner turns it on at their end when they register the proxy. The server owner can't read your messages, but, as Telegram's help page says, they can see your IP and when you connect. I've covered where to get a proxy server for Telegram and whom to trust with it separately.
Where to enter all this
In Telegram for Android the form opens through Settings → Data and Storage → Proxy Settings → Add Proxy, and the type you need there is MTProto Proxy. On iPhone it starts the same way, in Data and Storage, then the Proxy screen and Add Proxy. Telegram Desktop hides it deeper: Settings → Advanced → Connection type → Use custom proxy, and then Add proxy. In Telegram for macOS the form also lives in the data and storage settings, so if an instruction gives you the Telegram Desktop path for a Mac, it has mixed up the two apps.
- Open the form for adding a proxy.
- Choose the MTProto type (in Telegram Desktop it's already selected for a new proxy).
- In the Server or Hostname field, enter the address from the first line.
- In the Port field, enter the number from the second.
- In the Secret field, paste the third line in full and check its length, more on that below.
- Save and look at the status in the proxy list.
In the Telegram Desktop form, the Hostname and Port fields sit under the heading "Socket address", the Secret field under "Credentials", and below the type selector there's a warning: "This proxy may display a sponsored channel in your chat list. This doesn't reveal any of your Telegram traffic." It's part of the form itself and has nothing to do with the particular proxy you were sent.
If you do have a link after all, it's easier to tap it, because it holds the same three values. In Telegram for Android, when a proxy link is on the clipboard, the add screen shows a "Paste from clipboard" item, and it fills in all three fields by itself. Telegram Desktop has a similar "Add proxy from clipboard" item. And a link with a long secret that won't open in a browser can be pasted into any chat in Telegram and tapped there.
How to tell the secret was copied in full
A secret is easy to spoil when copying: the end didn't get selected, or the line got wrapped. But you can see it by the length. A regular secret is 32 characters long, digits and Latin letters from a to f. If it starts with dd, it has 34 characters, and this prefix turns on random padding of packets. With ee at the start the secret is longer, 42 characters or more, because a website name is written into its tail.
Take a made-up example of a secret starting with ee with the name www.example.com in its tail: ee000000000000000000000000000000007777772e6578616d706c652e636f6d.
It's 64 characters long: ee, then the 32 characters of the secret itself, and everything after the 34th character is www.example.com written out in digits and letters. A real secret will be different, but it's built the same way. Counting characters with your finger on the screen isn't much fun, but you can put up with it once.
Telegram Desktop's rules are these. A secret of the right length with the right start is accepted, and a secret of a different length or with a different start is treated, depending on the length, as unsupported or invalid. So if you cut the last character off a made-up 32-character secret, by these rules it comes out "unsupported", and if only half of it is left, "invalid".
There's one more catch, and it's why I'd check the length after every paste. The Secret field in Telegram Desktop lets through only Latin letters, digits, - and _, and silently throws everything else away. An extra space at the end it will simply remove, but a letter typed in another keyboard layout, say a Cyrillic "а" that looks just like a Latin "a", will disappear, and the secret becomes one character shorter. The same happens to + and / typed by hand, so a secret with these characters is more reliable to connect with a link.
When you save, Telegram Desktop checks the fields. An empty Hostname or port 0 gets highlighted as an error, a wrong secret gets highlighted in the Secret field, and the window won't close. If the proxy came as a link, the message "This proxy link uses invalid secret parameter…" means Telegram rejected the secret specifically. And once everything is accepted, the proxy list shows a status: "online", "available (ping: … ms)" or "not available", and a shield icon appears at the top of the chat list.
What Telegram fixes for you and what it doesn't
Telegram Desktop has a couple of small allowances. If you type a comma instead of a dot in the address, the Hostname field replaces it with a dot by itself. If you paste an IP made of numbers with dots into Hostname together with the port after a colon, like the made-up 1.2.3.4:443, the port moves into the Port field by itself. With a server name instead of numbers this won't happen, and you'll have to enter the port separately. The Port field accepts a number no greater than 65535, and on Android you can type only digits there, and anything above 65535 turns into 65535.
Telegram won't fix a secret from another server for you. This happens when you take the address and port from one message and the secret from another one next to it: the lines look alike, but the server expects its own secret. So take all three values from the same server, ideally from the same message. Telegram won't complete a cut-off secret either, it will only reject it. And if you were sent a username and password along with the address and port, it's most likely a SOCKS5 proxy, so choose that type, and you won't need the Secret field.
And if you'd rather not type anything
Finally, as promised, about us. FreeGate gives you a personal MTProto proxy, and you connect it with a button, not through three fields. You tap "Connect in Telegram" or scan the QR code, Telegram asks about the proxy, and you tap "Connect Proxy". Each device gets its own link, and it works only for you. If it leaks, you can change it in your account with one tap, and the old one stops working at once.
You can try it for free: 1 day after you sign up with your email and confirm it, with no payment and no automatic charges. After that it's $1.00 for 30 days or $2.50 for 90 days, price per device, so for a phone and a computer choose 2 when buying. The proxy works in the official Telegram apps, and Telegram Web doesn't support proxies. Details at freegate.app/world.