How to Implement Authorization Using a Telegram API (2023)

How to implement authorization using a Telegram API?

So far I have been able to implement the telegram authorization completely, but not in your requested language - PHP, I used vb.Net. However, I believe the same logic should apply.

Creating a Telegram Authorization Key

Telegram API is no walk in the park. Studying existing src code could be quite daunting (IMHO). Hence my approach was to study the online API documentation and implement the sample-auth_key outlined in the links below.

What this approach will give you is a better understanding and introduction to the primitives used throughout Telegram API, and possibly help you start organizing your own set of functions and routines to handle which you will need for the next steps - implementing other features of the API, since generating an AuthKey is just the beginning.

Step 1

All Communication is via TCP - Once you have obtained a unique api_id ( you will find the following IP advertised for use in testing: The api_id is not required at this point for generating an AuthKey

Setup your preferred method of Send/Receive TCP processing Loop

what I have is a private SendData that simply sends a bytes to a live socket connected to the give IP address above

Private Sub SendData(b() As Byte, Optional read As Boolean = False)
If Not IsConnected() Then
Log("Connection Closed!", ConsoleColor.DarkRed)
RaiseEvent Disconneted()
Exit Sub
End If

b = TCPPack(b)

Dim arg = New SocketAsyncEventArgs With {.RemoteEndPoint = ep}
AddHandler arg.Completed, AddressOf IO_Handler
arg.SetBuffer(b, 0, b.Length)

If Not soc.SendAsync(arg) Then
IO_Handler(soc, arg)
End If

If read Then
End If
Catch ex As Exception
Log("SendData: " & ex.ToString, ConsoleColor.Red)
End Try

End Sub

Private Sub ReadData(Optional wait As Integer = 0)
If Not IsConnected() Then
Log("Connection Closed!", ConsoleColor.DarkRed)
RaiseEvent Disconneted()
Exit Sub
End If

Dim arg = New SocketAsyncEventArgs With {.RemoteEndPoint = ep}
AddHandler arg.Completed, AddressOf IO_Handler

Dim b(BUFFER_SIZE - 1) As Byte
arg.SetBuffer(b, 0, BUFFER_SIZE)

If Not soc.ReceiveAsync(arg) Then
IO_Handler(soc, arg)
End If
Catch ex As Exception
Log("ReadMessages: " & ex.ToString, ConsoleColor.Red)
End Try
End Sub

Private Sub IO_Handler(sender As Object, e As SocketAsyncEventArgs)
Log($"{e.LastOperation}:{e.SocketError}:{e.BytesTransferred}", ConsoleColor.Cyan)

Select Case e.SocketError
Case SocketError.Success
Select Case e.LastOperation
Case SocketAsyncOperation.Connect 'A socket Connect operation.
Log("Connected to " & e.ConnectSocket.RemoteEndPoint.ToString, ConsoleColor.Green)

Case SocketAsyncOperation.Disconnect, SocketAsyncOperation.Connect
RaiseEvent Disconneted()

Case SocketAsyncOperation.Receive 'A socket Receive operation.
End Select

Case SocketError.ConnectionAborted
RaiseEvent Disconneted()
End Select
End Sub

Private Sub HandleData(e As SocketAsyncEventArgs)
If e.BytesTransferred = 0 Then --no pending data
Log("The remote end has closed the connection.")
Exit Sub
End If

Dim len As Integer = e.Buffer(0)
Dim start = 1

If len = &H7F Then
len = e.Buffer(1)
len += e.Buffer(2) << 8
len += e.Buffer(3) << 16
start = 4
End If

len = 4 * len

(Video) How to implement authorization using a Telegram API - PHP

Dim data(len - 1) As Byte
Array.Copy(e.Buffer, start, data, 0, len)


End Sub

Finally for this step, we need a TcpPack() method which helps us pad our data in the format Telegram expects - see code below with comments

Private Function TCPPack(b As Byte()) As Byte()
Dim a = New List(Of Byte)
Dim len = CByte(b.Length / 4)

If efSent = False Then --TCP abridged version
efSent = True
End If

If len >= &H7F Then
End If

a.AddRange(b) --only data, no sequence number, no CRC32

Return a.ToArray
End Function


With the basic TCP send/receive routines setup, we can start preparing data packets to send to telegram and have sub routines for handling the specific responses received - ProcessResponse(data)

What we need to understand next is the fact that Telegram handles 2 broad categories of messages -

Unencrypted -

These are plain text messages with their auth_key_id =0 generating an AuthKey uses this type of message throughout

Encrypted -

All further communication with Telegram Servers will be via encrypted messages

I choose to have two classes to encapsulate both message types. I can then have two Send(m) methods that handles each type

Private Sub Send(m As UnencryptedMessage)
Log(m.ToString, ConsoleColor.DarkYellow, logTime:=False)
SendData(, True)
End Sub

Private Sub Send(m As EncryptedMessage)
Log(m.ToString, ConsoleColor.DarkYellow, logTime:=False)
SendData(, True)
End Sub

For now only UnencryptedMessage is required

Public Class UnencryptedMessage
Public Property auth_key_id As Int64
Public Property message_id As Int64
Public Property data_length As Int32
Public Property message_data As Byte()
Public Property message_type As String
Public Property data As Byte() = {}

Sub New(auth_key As Int64, message_id As Int64, data As Byte())
_auth_key_id = auth_key
_message_id = message_id
_data_length = data.Length
_message_data = data
message_type = B2Hr(data, 0, 4)

Dim a = New List(Of Byte)

a.AddRange(BitConverter.GetBytes(auth_key_id)) --{0, 0, 0, 0, 0, 0, 0, 0}
a.AddRange(message_data) = a.ToArray
End Sub

Sub New(b As Byte())
data = b

Dim skip = 0

_auth_key_id = BitConverter.ToInt64(b, skip) : skip += 8
_message_id = BitConverter.ToInt64(b, skip) : skip += 8
_data_length = BitConverter.ToInt32(b, skip) : skip += 4

ReDim _message_data(_data_length - 1)

Array.Copy(b, skip, _message_data, 0, b.Length - skip)

message_type = B2Hr(_message_data, 0, 4)
End Sub

(Video) How to get API ID & API HASH of a Telegram Account | No Errors | By Bemro

Public Overrides Function ToString() As String
Return $"
raw_data: {B2H(data)}
auth_key_id: {i2H(auth_key_id)} {auth_key_id}
message_id: {i2H(message_id)} {message_id}
data_length: {i2H(data_length)} {data_length}
message_data: {B2H(message_data)}
message_type: {message_type}
End Function
End Class


Now we follow he series of steps outlined in

  1. Client sends query to server

req_pq#60469778 nonce:int128 = ResPQ The value of nonce is selected
randomly by the client (random number) and identifies the client
within this communication. Following this step, it is known to all.

  1. Server sends response of the form

resPQ#05162463 nonce:int128 server_nonce:int128 pq:string
server_public_key_fingerprints:Vector long = ResPQ

My approach for this is very simple:

Sub RequestPQAuthorization()
End Sub

In a Class called MTProto I implement a set of shared functions as required by each step of the exchange. Each method is simply building up an Encrypted data structure which will be sent as above where required

We start with: req_pq

Shared Function req_pq(Optional nonce As Byte() = Nothing) As UnencryptedMessage
If nonce Is Nothing Then
ReDim nonce(15)
End If

Dim d = New List(Of Byte)
d.AddRange({120, 151, 70, 96}) --60469778

Return New UnencryptedMessage(0, CreateMessageId, d.ToArray)
End Function

Private Shared Function CreateMessageId() As Int64
Return CLng((Date.UtcNow.Ticks - ZERO_TICK) * 429.4967296)
End Function

Public Const ZERO_TICK = 621355968000000000 -- i.e. 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC)

Now our process response method from Step 1

Private Sub ProcessResponse(data As Byte())
Dim r = New UnencryptedMessage(data)
Log(r.ToString, ConsoleColor.Yellow, logTime:=False)

Select Case r.message_type
Case resPQ.Classid
RequestDHKeyExchange(New resPQ(r.message_data))
Case server_DH_params_ok.Classid
RequestSetDH_params(New server_DH_params_ok(r.message_data), new_nonce)
Case server_DH_params_fail.Classid
Log(New server_DH_params_fail(r.message_data).ToString, ConsoleColor.DarkMagenta)
Case dh_gen_ok.Classid
Log(New dh_gen_ok(r.message_data).ToString, ConsoleColor.Green)
Case dh_gen_retry.Classid
Log(New dh_gen_retry(r.message_data).ToString, ConsoleColor.DarkMagenta)
Case dh_gen_fail.Classid
Log(New dh_gen_fail(r.message_data).ToString, ConsoleColor.DarkMagenta)
Case Else
Log($"Unhandled type: {r.message_type}", ConsoleColor.Magenta)
End Select
Catch ex As Exception
Log($"Error: {ex.ToString}", ConsoleColor.Red)
Log(B2H(data), ConsoleColor.DarkRed, logTime:=False)
End Try
End Sub

Great so far, each response received has a message_type code.

we can switch on that and determine how each is handled. We need to process resPQ right now.

What i have done is to create a a set of classes that each handles a specific response type

''' <summary>
''' resPQ#05162463
''' nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector long = ResPQ
''' </summary>
Public NotInheritable Class resPQ : Inherits TLObject
Public Shared Shadows ReadOnly Property Classid As String = "05162463"
Public Property nonce As Byte()
Public Property server_nonce As Byte()
Public Property pq As Byte()
Public Property fingerprints As List(Of UInt64)
Public Property count As Int32

Sub New(data As Byte())
Dim skip = 4
nonce = Slice(data, skip, 16) : skip += 16
server_nonce = Slice(data, skip, 16) : skip += 16
skip += 1 'length of pq:string
pq = Slice(data, skip, 8) : skip += 8
skip += 3 'padding to complete the 4-bytes
skip += 4 '%(Vector long) 1cb5c415
count = i32r(data, skip) : skip += 4

fingerprints = New List(Of UInt64)

For i = 0 To count - 1
fingerprints.Add(u64r(data, skip))
End Sub

Public Overrides Function ToString() As String
Return $"
classid: {NameOf(resPQ)}#{Classid}
nonce: {B2H(nonce)}
server_nonce: {B2H(server_nonce)}
pq: {B2H(pq)} {u64(pq)}
count: {i2H(count)} {count}
fingerprints: {i2H(fingerprints(0))} {fingerprints(0)}
End Function
End Class

Each is based on this simple object

Public MustInherit Class TLObject
Public Shared Property ClassId As String
Public MustOverride Overrides Function ToString() As String
End Class

Building on this, we tackle steps 3 & 4

Proof of work 3) Client decomposes pq into prime factors such that p <

This starts a round of Diffie-Hellman key exchanges.

Presenting proof of work; Server authentication 4) Client sends query
to server

req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string
q:string public_key_fingerprint:long encrypted_data:string =

This is initiated here RequestDHKeyExchange(New resPQ(r.message_data)) in my ProcessResponse routine above

(Video) Fetch Telegram Messages with Angular via Telegram API (not bot API!)

Sub RequestDHKeyExchange(r As resPQ)
Log(r.ToString, ConsoleColor.Gray, logTime:=False)

'decompose prime cofactors
Dim pp = New PrimeProduct(r.pq)
Log(pp.ToString, ConsoleColor.Gray, logTime:=False)

'encrypted_data Generation
Dim pq = New P_Q_inner_data(r.pq, pp.p, pp.q, r.nonce, r.server_nonce)
new_nonce = pq.new_nonce

'The serialization Of P_Q_inner_data produces some String data. This Is followed by encrypted_data
'data_with_hash := SHA1(data) + data + (any random bytes); such that the length equal 255
Dim data_with_hash = New List(Of Byte)

'SHA1(data) = xxx- 40 =20 bytes
Using sha1 = New SHA1Managed
Dim b = pq.ToBytes
End Using

If data_with_hash.Count < 255 Then
Dim pad(255 - data_with_hash.Count - 1) As Byte
End If

'RSA(data_with_hash, server_public_key) = xxx - 512 = 256 bytes
Dim key = i2H(r.fingerprints(0)) 'c3b42b026ce86b21
Dim zb = Crypto.rsaEncrypt(data_with_hash.ToArray, key)
Send(MTProto.req_DH_params(r.nonce, r.server_nonce, pp.p, pp.q, r.fingerprints(0), zb))
End Sub

You can use your own implementation of Prime-Decomposition to replace this line Dim pp = New PrimeProduct(r.pq)

Here is an example of how I learnt do it using PollardBrent (Pollard Rho Brent Integer Factorization)

Okay if you can follow up to this point you have a general idea of how i'm decomposing the AuthKey implementation step by step.

You should be able to run through the remaining steps 5-9. It's a lot for me to type...

If this answer so far is of any help to anyone, then i'll take out time to organize and post the remaining part.

I believe that the routines and knowledge you build up along the way should give you the tools you need to both understand and implement your own independent Telegram API code from scratch.

Completed Interaction Dump

03:33:26.591 Connect:Success:0
03:33:26.593 Connected to
raw_data: 000000000000000000DC799836FE075614000000789746604479257F6C01C039A3DEAD031BC2D6A4
auth_key_id: 0000000000000000 0
message_id: 5607FE369879DC00 6199202922538589184
data_length: 00000014 20
message_data: 789746604479257F6C01C039A3DEAD031BC2D6A4
message_type: 60469778

03:33:26.600 Send:Success:42
03:33:26.735 Receive:Success:85
raw_data: 0000000000000000015CF64539FE075640000000632416054479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153D0818DDCAF407B7CDCD00000015C4B51C01000000216BE86C022BB4C3
auth_key_id: 0000000000000000 0
message_id: 5607FE3945F65C01 6199202934039141377
data_length: 00000040 64
message_data: 632416054479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153D0818DDCAF407B7CDCD00000015C4B51C01000000216BE86C022BB4C3
message_type: 05162463

classid: resPQ#05162463
nonce: 4479257F6C01C039A3DEAD031BC2D6A4
server_nonce: 4F9DB065B36308CF4D9965725DD7153D
pq: 18DDCAF407B7CDCD 1791811376213642701
count: 00000001 1
fingerprints: C3B42B026CE86B21 14101943622620965665

PQ: 18DDCAF407B7CDCD 1791811376213642701
P: 45F57B87 1173715847
Q: 5AFE490B 1526614283

raw_data: 000000000000000000403CEE36FE075640010000BEE412D74479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153D0445F57B87000000045AFE490B000000216BE86C022BB4C3FE0001002DD190DDD93DFFC9EAF14DFAD3018D101E9E3EEC6C3FF4C7C1A067B32FB19AA2FDDFD087094947E793FA9F1A10A36A0B2916609811CFF1F345EE8FD9CDFFBCA4555E33A0446AB4A534500F621D112FCF59CAD4961BC87375F6835460B2E1B3B4088CE79843F7445DC5D87E0ACB0C4A979F68240C06358C4D2F95F86C0535CA643FBE8AF730E70BCBB54191D4F110E50D3244882722605657E808382445FA070A67AED1B2835238C05A00EBE960106838A284BC03D7A01453BA5355F06952F686263DD5B22B66524ED47F843340E9B7FC75BD58B6CC376C0B8B89E7292EDCC08D6CD0F1F9BF8418C2A58BC82B1928B051B3A0C20FA0AB22BA822EFABA6E141508
auth_key_id: 0000000000000000 0
message_id: 5607FE36EE3C4000 6199202923977392128
data_length: 00000140 320
message_data: BEE412D74479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153D0445F57B87000000045AFE490B000000216BE86C022BB4C3FE0001002DD190DDD93DFFC9EAF14DFAD3018D101E9E3EEC6C3FF4C7C1A067B32FB19AA2FDDFD087094947E793FA9F1A10A36A0B2916609811CFF1F345EE8FD9CDFFBCA4555E33A0446AB4A534500F621D112FCF59CAD4961BC87375F6835460B2E1B3B4088CE79843F7445DC5D87E0ACB0C4A979F68240C06358C4D2F95F86C0535CA643FBE8AF730E70BCBB54191D4F110E50D3244882722605657E808382445FA070A67AED1B2835238C05A00EBE960106838A284BC03D7A01453BA5355F06952F686263DD5B22B66524ED47F843340E9B7FC75BD58B6CC376C0B8B89E7292EDCC08D6CD0F1F9BF8418C2A58BC82B1928B051B3A0C20FA0AB22BA822EFABA6E141508
message_type: D712E4BE

03:33:26.933 Send:Success:341
03:33:27.217 Receive:Success:656
raw_data: 0000000000000000011C9A9F39FE0756780200005C07E8D04479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153DFE500200752C7BDBB6A58D68B76D2E20DCECF611B2837CA34F3688B242192C633FBBC1EC9348880DA6E6AFF42B256D8476A2C432B60E93218F5B84982B0F9800E6EF918AEC4B729AB1A67C82EF2C4D281352D1BEAEB6B9026CAA0CA8FB03F9257E2CA034471EE25CF6E214BB770E233566A67155BE8FB8F9DA0A76964CFD19E9C97D3E57AAA26E7A6C16B12F2B2BFD4C437857032F0A7198567B9CD3A54BD06CE61A1EBACD70D464185719BC8E0381C99E80A5783D389BE73E97166A328CEDB3AA4D722D453EB4CA893299E41DDC81C798BC76CAF070BFF144F6800D8FE5B3B6BCC9A1138E7ADA6DAF3F581AAB0137A6D40E640E76F6539B1450EA30A55E3F56C2C0A8DCC6F9F4D4F185D25AF37B46B9D9B8ED5CA257DD32EDE02FF95C6174C9D4BA1E30035723C7E2DED9EB0794AAA1913073E4EA2D5649C5C491B252AF88FF1D71EFB5E9FFCA921F0F27F72723DD5014359D08101278DF3F9A9A10DDE54B93A386C6844A6D15AF142DA956A3999458D10BBDE4E947BE949199F088B91175EC9EEE3C95AC47C96D802B0DC91AA6DB5B8A03E0985412DD23CD33FD961175CD271E02BF8A05A537E8FE21CDB40EBAAC0C8D4718DA4499D5B5EF935B848F92C25E9CAE76021758EDD1AA202A0D0DC357348B0474069002EB8F5F2760F2C5BEE38C7CEA07737C28864F647F2406BD55ABD58EEED97A4C8E659143441B1F8CB8DEFE457B46B5E76541CAB63FA1CD3626F0A45DB8A37964BF2613A6C64E6E6E478D44A2AF19CAD6C2686FD55EC85CACD645E58C364CBBD09EF1C7FE7420A8EF277982B87CA18D16B97980B14D24747D9BC86563DA81DA
auth_key_id: 0000000000000000 0
message_id: 5607FE399F9A1C01 6199202935543045121
data_length: 00000278 632
message_data: 5C07E8D04479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153DFE500200752C7BDBB6A58D68B76D2E20DCECF611B2837CA34F3688B242192C633FBBC1EC9348880DA6E6AFF42B256D8476A2C432B60E93218F5B84982B0F9800E6EF918AEC4B729AB1A67C82EF2C4D281352D1BEAEB6B9026CAA0CA8FB03F9257E2CA034471EE25CF6E214BB770E233566A67155BE8FB8F9DA0A76964CFD19E9C97D3E57AAA26E7A6C16B12F2B2BFD4C437857032F0A7198567B9CD3A54BD06CE61A1EBACD70D464185719BC8E0381C99E80A5783D389BE73E97166A328CEDB3AA4D722D453EB4CA893299E41DDC81C798BC76CAF070BFF144F6800D8FE5B3B6BCC9A1138E7ADA6DAF3F581AAB0137A6D40E640E76F6539B1450EA30A55E3F56C2C0A8DCC6F9F4D4F185D25AF37B46B9D9B8ED5CA257DD32EDE02FF95C6174C9D4BA1E30035723C7E2DED9EB0794AAA1913073E4EA2D5649C5C491B252AF88FF1D71EFB5E9FFCA921F0F27F72723DD5014359D08101278DF3F9A9A10DDE54B93A386C6844A6D15AF142DA956A3999458D10BBDE4E947BE949199F088B91175EC9EEE3C95AC47C96D802B0DC91AA6DB5B8A03E0985412DD23CD33FD961175CD271E02BF8A05A537E8FE21CDB40EBAAC0C8D4718DA4499D5B5EF935B848F92C25E9CAE76021758EDD1AA202A0D0DC357348B0474069002EB8F5F2760F2C5BEE38C7CEA07737C28864F647F2406BD55ABD58EEED97A4C8E659143441B1F8CB8DEFE457B46B5E76541CAB63FA1CD3626F0A45DB8A37964BF2613A6C64E6E6E478D44A2AF19CAD6C2686FD55EC85CACD645E58C364CBBD09EF1C7FE7420A8EF277982B87CA18D16B97980B14D24747D9BC86563DA81DA
message_type: D0E8075C

classid: server_DH_params_ok#D0E8075C
nonce: 4479257F6C01C039A3DEAD031BC2D6A4
server_nonce: 4F9DB065B36308CF4D9965725DD7153D
enc_answer: 752C7BDBB6A58D68B76D2E20DCECF611B2837CA34F3688B242192C633FBBC1EC9348880DA6E6AFF42B256D8476A2C432B60E93218F5B84982B0F9800E6EF918AEC4B729AB1A67C82EF2C4D281352D1BEAEB6B9026CAA0CA8FB03F9257E2CA034471EE25CF6E214BB770E233566A67155BE8FB8F9DA0A76964CFD19E9C97D3E57AAA26E7A6C16B12F2B2BFD4C437857032F0A7198567B9CD3A54BD06CE61A1EBACD70D464185719BC8E0381C99E80A5783D389BE73E97166A328CEDB3AA4D722D453EB4CA893299E41DDC81C798BC76CAF070BFF144F6800D8FE5B3B6BCC9A1138E7ADA6DAF3F581AAB0137A6D40E640E76F6539B1450EA30A55E3F56C2C0A8DCC6F9F4D4F185D25AF37B46B9D9B8ED5CA257DD32EDE02FF95C6174C9D4BA1E30035723C7E2DED9EB0794AAA1913073E4EA2D5649C5C491B252AF88FF1D71EFB5E9FFCA921F0F27F72723DD5014359D08101278DF3F9A9A10DDE54B93A386C6844A6D15AF142DA956A3999458D10BBDE4E947BE949199F088B91175EC9EEE3C95AC47C96D802B0DC91AA6DB5B8A03E0985412DD23CD33FD961175CD271E02BF8A05A537E8FE21CDB40EBAAC0C8D4718DA4499D5B5EF935B848F92C25E9CAE76021758EDD1AA202A0D0DC357348B0474069002EB8F5F2760F2C5BEE38C7CEA07737C28864F647F2406BD55ABD58EEED97A4C8E659143441B1F8CB8DEFE457B46B5E76541CAB63FA1CD3626F0A45DB8A37964BF2613A6C64E6E6E478D44A2AF19CAD6C2686FD55EC85CACD645E58C364CBBD09EF1C7FE7420A8EF277982B87CA18D16B97980B14D24747D9BC86563DA81DA

tmp_aes_key: 297CB750FF0052B67515B3F11B45F11F15D106BC25ED0027570D5B9D83102BFA
tmp_aes_iv: CBDCF40A77B6A1C7CE74A1F8EC8E091A49FAD3B9A2499BFFFD084D537A53B36D
answer: BA0D89B54479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153D03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE000100C49E858CA0107FF9B51DC88236370866BE4A69DDC2193930769C11722D2884CE5017AF60712B6BAC17F79DBA8701A25AAA901FDCB483C56A246C1CA7705FAA87F0AFD68EAC8FC5EC88307298DAF7252DD6D8630BF819D65F9E4B5624B6A05149B35B8509A63C2F2D05417F38DD0A90727F5D12CC4D213B5974C732FB261F6AC01426F2B7269C17230442AA8C9AFCCD927463C4EC8465F841D969F0C47FC270D8EC23B1F5D861EB6A5602CF6F87A02A56A4094E06509503CACE935461086668AC32E8C69A90EB19C3232B20635DFADFC6E4EDC11FA34A3E2E2BBA28DDCEF422120077D3A171A6A5B65744113AF0D0A1FC566D31DBBDB43F5DE35A7CE5F0BB0ECD39FE0756646CF781176C3EAC

classid: Server_DH_inner_data#B5890DBA
nonce: 4479257F6C01C039A3DEAD031BC2D6A4
server_nonce: 4F9DB065B36308CF4D9965725DD7153D
g: 00000003 3
dh_prime: C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5B
g_a: C49E858CA0107FF9B51DC88236370866BE4A69DDC2193930769C11722D2884CE5017AF60712B6BAC17F79DBA8701A25AAA901FDCB483C56A246C1CA7705FAA87F0AFD68EAC8FC5EC88307298DAF7252DD6D8630BF819D65F9E4B5624B6A05149B35B8509A63C2F2D05417F38DD0A90727F5D12CC4D213B5974C732FB261F6AC01426F2B7269C17230442AA8C9AFCCD927463C4EC8465F841D969F0C47FC270D8EC23B1F5D861EB6A5602CF6F87A02A56A4094E06509503CACE935461086668AC32E8C69A90EB19C3232B20635DFADFC6E4EDC11FA34A3E2E2BBA28DDCEF422120077D3A171A6A5B65744113AF0D0A1FC566D31DBBDB43F5DE35A7CE5F0BB0ECD
server_time: 5607FE39 1443364409
client_time: 5607FE37 1443364407
padding: 646CF781176C3EAC

DH_Prime is Safe? = True

classid: Client_DH_Inner_Data#6643B654
nonce: 4479257F6C01C039A3DEAD031BC2D6A4
server_nonce: 4F9DB065B36308CF4D9965725DD7153D
retry_id: 0000000000000000 0
g_b: 923A21384FE0318D569B2F2BEA667D1A999050A0A1B5AFDA39F2B890DEE45F9ED08E319C8243CD1496269CCF956DFA6C98633BDC2E26B1675C15D7904417EC2A74C687E682ED14182178BC0BD189F6E020131C87FD42A24798FCCD2416348EE0AAF534B652175BAC33E89C82874A8C3E8562815DDA213610167B10153EFC1BD1A0CFBACFEA22E3E8D80917F262D2C67BF1327A245CF7FE0E299F7517EE6A2F65568630A6191FEB0C1254F260A6554ED2BEE19E94AAB693E58DD032C26B9CAFEB0482F12DE2573B6E6D2816AC37ADDF3B99525FDBAF94690926320CC67ABF35D3EA6EC6CC7211BAF11FBDD6897959F6F1E3D4335B89B3024C1B3C0066246B5DCD

03:33:27.590 enc_data: 0A974C499344B093ADF321597858B1A6179E2A6C21F5FF9EB5DE687CDB57F8059509482FF9846FBE99D9411C13A645B26F73960424A13337D87DA879864FCA9D0883B643CF8EB594446038E0B6C4FD606D0CB77F1E00CCA6291DD65733F6A60217C7F366AD88972F107C381FD375F49DB57A2AB96988EC916629CD6F58B53F65DF4909AA773CCA43CE43671CA313528190213CF28A3B29BE26865BE22EB0C41E89CBD698C96CBC1B7B7F1586FBD61B422693859843F7D32083E3AB23D607FC4B874DB849F430F74483969ABA4603B483C94BCEB38F8EC90EEB58B338B325A8E37B57813CEC7E795B1B5517D732227856955C53BA18F52E55C6BCD8F1419D43D46DF2C2560B74BA7AA961BB4BDD09ABBC95E4F57AC4B8C89A67C7C5453A3EFB635D3977E0C3F0067C1F4D255F1F87E74A8E7E4272DFDEB9B85ABBEFA4953B2E0ECAA15C3C77773155C4013955BAB0D85F
03:33:27.810 auth_Key: 87A801A14AD6426E6AD56B638B315DF9F5B66F77333DC8C0FAADB77A1D51E71B68F5BB9B21DB275F2C4CA495E6440DDEACBDB199C52C327F7E2E9D78921E0D632CCA63DB6384FAF387E9D41717899EE5D54609C2F88573BBE8128FB5864CB62BC7F0ED250CBB57929AA5198FE568FC76FB846262A505B42D04BCB87C9EB24007CE9F9BDEB79391E7E9425F3A3D5028410E129C078EB8644EAB770F8705D8228CFAEAA4478A0D8E326971C7C2223074C4302C1F1DE5D08AC00CBEBEE41981B57A4248B517386DE68A51D01087F0E58D75A4C0FD2D031BC5BFC08651C4133494B572150EDD1C486153E8F51F99771DD57F55B3A5BBAE1874F25E69150C4E3C1397
raw_data: 0000000000000000009C48D037FE0756780100001F5F04F54479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153DFE5001000A974C499344B093ADF321597858B1A6179E2A6C21F5FF9EB5DE687CDB57F8059509482FF9846FBE99D9411C13A645B26F73960424A13337D87DA879864FCA9D0883B643CF8EB594446038E0B6C4FD606D0CB77F1E00CCA6291DD65733F6A60217C7F366AD88972F107C381FD375F49DB57A2AB96988EC916629CD6F58B53F65DF4909AA773CCA43CE43671CA313528190213CF28A3B29BE26865BE22EB0C41E89CBD698C96CBC1B7B7F1586FBD61B422693859843F7D32083E3AB23D607FC4B874DB849F430F74483969ABA4603B483C94BCEB38F8EC90EEB58B338B325A8E37B57813CEC7E795B1B5517D732227856955C53BA18F52E55C6BCD8F1419D43D46DF2C2560B74BA7AA961BB4BDD09ABBC95E4F57AC4B8C89A67C7C5453A3EFB635D3977E0C3F0067C1F4D255F1F87E74A8E7E4272DFDEB9B85ABBEFA4953B2E0ECAA15C3C77773155C4013955BAB0D85F
auth_key_id: 0000000000000000 0
message_id: 5607FE37D0489C00 6199202927769852928
data_length: 00000178 376
message_data: 1F5F04F54479257F6C01C039A3DEAD031BC2D6A44F9DB065B36308CF4D9965725DD7153DFE5001000A974C499344B093ADF321597858B1A6179E2A6C21F5FF9EB5DE687CDB57F8059509482FF9846FBE99D9411C13A645B26F73960424A13337D87DA879864FCA9D0883B643CF8EB594446038E0B6C4FD606D0CB77F1E00CCA6291DD65733F6A60217C7F366AD88972F107C381FD375F49DB57A2AB96988EC916629CD6F58B53F65DF4909AA773CCA43CE43671CA313528190213CF28A3B29BE26865BE22EB0C41E89CBD698C96CBC1B7B7F1586FBD61B422693859843F7D32083E3AB23D607FC4B874DB849F430F74483969ABA4603B483C94BCEB38F8EC90EEB58B338B325A8E37B57813CEC7E795B1B5517D732227856955C53BA18F52E55C6BCD8F1419D43D46DF2C2560B74BA7AA961BB4BDD09ABBC95E4F57AC4B8C89A67C7C5453A3EFB635D3977E0C3F0067C1F4D255F1F87E74A8E7E4272DFDEB9B85ABBEFA4953B2E0ECAA15C3C77773155C4013955BAB0D85F
message_type: F5045F1F

03:33:27.823 Send:Success:397
03:33:27.983 Receive:Success:73



How to use Google Oauth2.0 to authenticate user via Telegram Bot

It's currently indeed not very straight forward for a PTB-application to listen for external updates (the auth verification in this cas) - see also this issue. Currently it might be easiest for you to set up a custom webhook application that runs in parallel to the Updater - e.g. using flask/django/starlette/fastapi/…. Alternatively, if you're using webhooks for your bot anyway, you can patch the Updater to do the job for you. Although that requires some manual work - see here for an example.

(Video) Setup Telegram API without coding #telegram #automation #api

Once you are able to listen to updates coming from Google, handling them can be done via PTBs usual handler setup, specifically via the TypeHandler or even a custom Handler subclass - see this FAQ entry.

Regarding the redirect url: You'll want to redirect your user back to your bot, so you'll have to provide a link that does that. should probably do the trick.

Disclaimer: I'm currently the maintainer of python-telegram-bot.

Steps after creating Authorization Key for Telegram API

After creating your Auth_key I find it easiest to ensure I am connected to my nearest DataCenter before I proceed. Also you should send an InitConnection command along with the current layer (API version) that your code will be working with.

Here an example of what I send:

msg = TL.invokewithlayer(@layer, TL.initconnection(@app_id, @device_model, @system_version, @app_version, @lang_code, TL.help_getnearestdc))

Now before you send this here is some more background:

1) Telegram Servers communicate in TL, what it is basically is a custom developed encoding scheme that Telegram uses to express everything: from commands to all it's types. You would need to build yourself a decoder and encoder for converting raw bytes into TL and vice-versa.

2) Telegram updates their API versions from time to time, but the version on their site is outdated.

Related Topics

How to Use Pdo to Fetch a Results Array in PHP

MySQLi_Stmt::Bind_Result(): Number of Bind Variables Doesn't Match Number of Fields in Prepared Statement

MySQLi Update Throwing Call to a Member Function Bind_Param() Error

How to Create Websockets Server in PHP

PHP Pass by Reference in Foreach

How to Get the Jquery $.Ajax Error Response Text

How to Get an Array of Specific "Key" in Multidimensional Array Without Looping

500 Internal Server Error For PHP File Not For Html

PHP Ini File_Get_Contents External Url

Error When Preparing a Multiple Insert Query

Simple Xml - Dealing With Colons in Nodes

What Is the Best Ide For PHP

How to Create a Comma-separated List from an Array in PHP

Convert Time in Hh:Mm:Ss Format to Seconds Only

Is "MySQLi_Real_Escape_String" Enough to Avoid SQL Injection or Other SQL Attacks

Why Would $_Files Be Empty When Uploading Files to PHP

Get Operating System Info

Getting the Location from an Ip Address

(Video) Installing telethon and Authenticating Your Telegram Account.


What can I do with Telegram API? ›

Telegram APIs

This is the API used by Telegram apps for all your actions on Telegram. To name a few: viewing your chats, sending and receiving messages, changing your display picture or creating new groups. Through the Telegram API you can do anything you can do in a Telegram app programatically.

Can I use Telegram API? ›

We welcome all developers to use our API and source code to create Telegram-like messaging applications on our platform free of charge. In order to ensure consistency and security across the Telegram ecosystem, all third-party client apps must comply with the API Terms of Service.

How can I use Telegram API token? ›

Follow the link and click Open in Web or click Send message.
  1. Click Start.
  2. Select the command to create a new bot - /newbot.
  3. Now it's time to name your bot so that your customers can find this bot in Telegram. ...
  4. Enter the username of your bot. ...
  5. Copy your access token.
  6. Paste the access token and click Connect.
2 Nov 2020

How can I use Telegram API in Postman? ›

Start messaging BotFather ( on Telegram and then type /start .
  1. You'll see a list of commands that help you create, edit, and manage your bots. ...
  2. After giving the /newbot command, you get to pick a name and username for your bot. ...
  3. With that done, you'll be given your bot's API token.

Which Telegram API app is best? ›

Best Telegram Android Clients In 2022
  • Telegram X.
  • Plus Messenger.
  • Official Telegram/Telegram Beta.
  • NekogramX.
  • Graph Messenger/Telegraph Messenger.
20 Jan 2022

How can I integrate Telegram into my website? ›

How to Integrate Telegram on Your Website with
  1. Connect's website chat widget as a channel.
  2. Install the website chat widget on your website.
  3. Add a Telegram channel to the widget header.
13 Jun 2022

Is Telegram API free? ›

The Telegram API and TDLib allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. You can also add Telegram Widgets to your website. Designers are welcome to create Animated Stickers or Custom Themes for Telegram.

Is Telegram API secure? ›

No, Telegram Bot API's are not end to end encrypted.

Can I use Telegram as database? ›

You can use Telegram as a Database, thanks to TelegramDB. This feature is still in beta and this is just a pre-release.

How can I get Telegram bot API token? ›

1) Copy the access token (API key)

You can find it on the BotFather message logs. Alternatively, message /token @xxx to it, with xxx being the botname. For example, /token @cmbot.

What is the URL for Telegram API? ›

The first part of the URL indicates that you want to communicate with the Telegram API ( ).

How do I create a Telegram Webhook? ›

Below are the steps you can follow to set up Telegram Webhooks Integration:
  1. Step 1: Obtain the Authorization Token.
  2. Step 2: Set Up your Google Spreadsheet.
  3. Step 3: Create a Loading Dock.
  4. Step 4: Store the Links in Variables.
  5. Step 5: Set Up the Webhook.
  6. Step 6: Set Up the Bot.
  7. Step 7: Set Up the POST Requests.
18 Oct 2021

Which algorithm is used in Telegram? ›

Telegram uses a custom build symmetric encryption scheme called MTProto. The protocol was developed by Nikolai Durov and other developers at Telegram and is based on 256-bit symmetric AES encryption, 2048-bit RSA encryption and Diffie–Hellman key exchange.

Does Telegram have a web interface? ›

Telegram Web is a web-based version of Telegram messenger on any desktop browser. It allows users to sync their mobile app of Telegram to the Desktop or PC version. Users can send and receive messages through it.

What is Telegram Ifttt? ›

You can do more with Telegram and IFTTT. The messenger service you use for reliable and private messaging can be integrated with over 700 services to help you stay connected, get tailored notifications, and create new experiences.

What programming language does Telegram use? ›

Telegram Desktop was programmed with C++ and a handful of others. The Android app was built with Java. Swift was used for the iOS and MacOS native app. They're open source so you can see for yourself:…

Which language is best for Telegram bot? ›

You will begin by writing a simple bot at the start and then gradually build upon it. The simple yet effective Telegram Bot API makes it very easy to develop bots in a number of programming languages. Languages featured in the book include Node. js, Java, Rust, and Elixir.

What is the fastest Telegram app? ›

Telegram X is built to be noticeably faster and smoother than the main Telegram app—the animations are really impressive. You can also long-press on conversations to get a pop-up preview. Night mode? That's included in the app as well.

Can I integrate Telegram into my app? ›

Apiway allows you to integrate Telegram with thousands of the most popular tools. You can automate your workflow and have more time for main things—no code required.

Is Telegram part of the dark web? ›

Unlike the dark web, Telegram is a legitimate and easy-to-use service that isn't blocked by antivirus engines or network management tools.

Do Telegram admins get paid? ›

There is no paid advertising on Telegram. However, it doesn't mean that there are no paid ways to promote your channel. Paid promotion is possible on other Telegram channels and groups in your niche. All you have to do is to contact the channel admin and specify how you can get advertised on their channel.

How much does a telegram BOT cost? ›

How much does a Telegram chatbot cost?
Chatbot builderFree plan available?Price per 1000 messages
SnatchbotYes$30 per month
TrengoYes$28,50 per month
UbisendNo$417,16 per month
XeniooYes$36,39 per month
5 more rows
5 Apr 2022

Is Telegram fully open source? ›

Our apps are open source and support reproducible builds. This means that anyone can independently verify that our code on GitHub is the exact same code that was used to build the apps you download from App Store or Google Play.

Is Telegram safer than Signal? ›

If security and encryption are at the top of your list, Signal is the best option no matter which other features you use. If you want to be able to send encrypted messages only on occasion and make use of social-network-style features, then Telegram may be a better fit.

Is Telegram safer than WhatsApp? ›

Telegram is considered a safer and privacy-friendly app among many users compared to WhatsApp. However, Telegram lacks one key factor when it comes to securing user data and that's end-to-end encryption for chats. This means Telegram can access user chats stored on the server.

Which bot is best for Telegram group? ›

Combot (@combot): the virtual administrator

Combot is one of the most popular administration bots for Telegram out there. It provides very useful features that help with group moderation, analytics, filtering spam messages from group members, and much more. It is free of charge for smaller Telegram groups.

Does Telegram sell user data? ›

Telegram does not sell ads, stating that the access to personal data gained by advertisers would go against its ethos. Funding thus far comes privately from Pavel Durov. It has stated that it would turn to user donations or a freemium model to raise revenue if necessary.

Where Telegram stores its data? ›

These folders are located in the /data directory (which is the usual mount point of the user partition in the Android file system), and in particular in folders data (which is inaccessible to standard users) and media (whose access is instead unrestricted).

Is Telegram owned by Google? ›

Who owns Telegram? Telegram is owned by the same two people who founded the company in Russia back in 2013, Pavel Durov and his brother Nikolai. Pavel is also the company's CEO. Pavel Durov has been dubbed Russia's Mark Zuckerberg, as he had originally founded that country's biggest social networking site, known as VK.

Can I get a phone number by user ID via Telegram bot API? ›

It's possible with bots 2.0 check out bot api docs. you can check what is it. User can send itself phone number and also user can sand a contact. You need to compare user_id of sender of the message and user_id of contact.

How does Telegram bot token look like? ›

Authorizing your bot

The token looks something like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 , but we'll use simply <token> in this document instead. You can learn about obtaining tokens and generating new ones in this document.

How can I promote my Telegram bot? ›

How to Advertise on Telegram
  1. Sign up for a account. Sign up for a account (it's free & easy). ...
  2. Select Channels & Bots. Select the channels & bots you want to advertise on, there are thousands of options on ...
  3. Pay the Fees. ...
  4. Create your Ads.
26 Jan 2022

How can I get Telegram API and hash? ›

You must obtain your own api_id and api_hash as described in and specify them using the --api-id and --api-hash options or the TELEGRAM_API_ID and TELEGRAM_API_HASH environment variables.

How do I create a webhook API? ›

To set up a webhook, go to the settings page of your repository or organization. From there, click Webhooks, then Add webhook. Alternatively, you can choose to build and manage a webhook through the Webhooks API. Webhooks require a few configuration options before you can make use of them.

What is better than webhooks? ›

Clients make requests to an API to get data from the server instead of webhooks that push data to a server from the client. They are API requests, but they help the server instead of the client, so they do the opposite of what we usually think of as API requests.

How do you trigger a webhook? ›

Creating webhook triggers
  1. Open the Triggers page: Open the Build triggers page.
  2. Select your project from the top of the page and click Open.
  3. Click Create trigger.
  4. Click Create to create your build trigger.

Is Telegram a P2P? ›

Telegram normally asks users to use peer-to-peer (P2P) connection, setting that can be changed from settings to keep it private.

What is Telegram automation? ›

It is a python script that sends the Telegram messages automatically from the Telegram desktop application.

What is RTL in Telegram? ›

What is auto-RTL? Ability to recognize the language (specially first character) to switch typing direction automatically from default to right-to-left or vice versa in the field and showing sent messages in the correct direction: RTL/ltr.

What is difference between Telegram desktop and Telegram Web? ›

The only major difference between these two methods is that Telegram Desktop requires you to install an app while the web version works on just about any web browser. It should also be noted that Telegram Desktop and Telegram Web do not offer all the features found in the mobile version of the instant messaging app.

What is the difference between Telegram Web K and Z? ›

The subtle difference that can be observed on both the web apps is that the WebZ gets less white space than the WebK version and support single-color wallpapers. Telegram WebZ, WebK: How to use?

Can Telegram Web be used without phone? ›

Though you can't use Telegram without a phone number, you don't have to use your cell phone number. You can use your landline or an alternate number from an app such as Text Free, Google Voice, Burner, or TextNow. Telegram uses your number to verify your identity.

Is IFTTT still free? ›

Our free plan is perfect for anyone who is looking to create a few automations for specific devices or services. Our Pro plan is for you if you own multiple smart devices, are interested in building with multiple actions, or are looking for faster Applet speeds.

Is there a better app than IFTTT? ›

Microsoft Power Automate Compared To IFTTT

Microsoft Power Automate is rightfully the best app if you want your integrations to manage a lot of different documentation. It's also a much harder-to-learn app than IFTTT.

Do police monitor Telegram? ›

The FBI document says about Telegram: No message content. No contact information provided for law enforcement to pursue a court order. As per Telegram's privacy statement, for confirmed terrorist investigations, Telegram may disclose IP and phone number to relevant authorities.

Can I make money with Telegram bots? ›

This article will allow you to receive money from your bot, by targeting advertisements on your bot, with Boter and Paquebot. You will be able to monetize your audience and get some real cash on your bank account or on your PayPal account.

Is Telegram API safe? ›

No, Telegram Bot API's are not end to end encrypted. based on Telegram documentation end to end encryption are for user's chat, without mentioning about bots: Secret Chats are one-on-one chats wherein messages are encrypted with a key held only by the chat's participants.

Do Telegram bots pay? ›

If you have Telegram 4.0 (or newer) installed, you can order goods or services from bots that offer them. These bots may now add a Pay button to their messages. When you tap Pay, you'll be asked to fill in your credit card and shipping information and confirm the payment. Then you get what you paid for.

Can you make money on Telegram app? ›

There are several ways you can monetize your channel.

Sell advertising or paid posts to display on your channel. Another method is to create a private channel and charge a fee to join. By promoting valuable content users want, you can attract more subscribers.

How much does a telegram BOT cost? ›

How much does a Telegram chatbot cost?
Chatbot builderFree plan available?Price per 1000 messages
SnatchbotYes$30 per month
TrengoYes$28,50 per month
UbisendNo$417,16 per month
XeniooYes$36,39 per month
5 more rows
5 Apr 2022

How can I make a professional bot in Telegram? ›

How to Create a New Bot for Telegram
  1. Enter @Botfather in the search tab and choose this bot.
  2. Choose or type the /newbot command and send it.
  3. Choose a name for your bot — your subscribers will see it in the conversation. ...
  4. Go to the @BotFather bot and send the command /token .
13 Oct 2022

Is it difficult to create a telegram bot? ›

Compared to the process for building a Twitter bot, a Mastodon bot, or any other kind of bot I've experimented with, Telegram makes the initial setup super easy. I guess that proves what a great tool Telegram bots can be! After giving the /newbot command, you get to pick a name and username for your bot.

Is Telegram API free? ›

The Telegram API and TDLib allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. You can also add Telegram Widgets to your website. Designers are welcome to create Animated Stickers or Custom Themes for Telegram.

What is the backend of Telegram? ›

Programming Languages Behind Telegram –

They are Erlang, FreeBSD, Yaws, Lighttpd, PHP, and XMPP. Erlang is used for the real-time chatting feature. FreeBSD is responsible for the app to desktop transition or Web WhatsApp along with PHP.

What database does Telegram use? ›

Meet TDLib – the Telegram Database Library. TDLib takes care of all network implementation details, encryption and local data storage, so that developers can dedicate more time to design, responsive interfaces and beautiful animations.

Can I trust Telegram bots? ›

To keep your Telegram communications safe, don't add bots to your chats, and be aware when you're in chats and channels that include them. ... Many cryptographers and security engineers, though, including White, say that the safest way to use Telegram is just not to use it at all.

Can anyone use my telegram bot? ›

With Telegram bots are not private. Everybody can find them. The difference is that a certain communication channel with the bot can be made private. This is a group with the bot that you and the bot are members of.

How can I host a telegram Bot for free? ›

To create a Telegram bot, we need to download Telegram and create a user account. You can use Telegram from either your PC or your phone, or both. Once you have a Telegram account, you can register a new bot by sending a message to BotFather, a bot managed by Telegram themselves.

Who is the CEO of Telegram? ›

Telegram, a messaging app founded by Russian billionaire Pavel Durov, has become hugely popular in Ukraine.

How does Telegram pay for its servers? ›

So, yes, Telegram has plans to money through advertisements. But unlike Facebook and WhatsApp, these advertisements will not be microtargeted and will not use sensitive data of the users. These ads will only be available on one-to-many groups through Telegram's own ad platform.

How is money made on Telegram? ›

Telegram makes money by selling sponsored messages as well as through premium subscriptions. Launched in 2013, Telegram has grown to become one of the world's largest messaging platforms.


1. How to Create a Telegram Bot and Send Message via bot API
2. Creating and using a Telegram Bot with Java
(Sebastian Daschner)
3. How to send messages to Telegram Group using API requests | Telegram API | Telegram BOT management
4. C# Telegram Bot Tutorial Part 1: Setting up
5. Lecture 7: How to get Telegram API key
(Roman Akhromieiev)
6. How To Create A Telegram Bot API and Send Message in Group
Top Articles
Latest Posts
Article information

Author: Fredrick Kertzmann

Last Updated: 02/22/2023

Views: 6379

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Fredrick Kertzmann

Birthday: 2000-04-29

Address: Apt. 203 613 Huels Gateway, Ralphtown, LA 40204

Phone: +2135150832870

Job: Regional Design Producer

Hobby: Nordic skating, Lacemaking, Mountain biking, Rowing, Gardening, Water sports, role-playing games

Introduction: My name is Fredrick Kertzmann, I am a gleaming, encouraging, inexpensive, thankful, tender, quaint, precious person who loves writing and wants to share my knowledge and understanding with you.