This is the url that i have referred in order to send a message to telegram. https://medium.com/javarevisited/sending-a-message-to-a-telegram-channel-the-easy-way-eb0a0b32968
Meanwhile, i have got the api key from BotFather.
This is the returned error when I executed my code. The underlying connection was closed: An unexpected error occurred on a receive.
Private Function send() As Boolean
Try
Dim urlString As String = "https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}"
Dim apiToken As String = "6076412963:AAGy2bP3SGzeOBK_c6nH6nT5ubS6rjAPzi8"
Dim chatId As String = "109780439"
Dim text As String = "Hello world!"
urlString = String.Format(urlString, apiToken, chatId, text)
Dim request As WebRequest = WebRequest.Create(urlString)
Dim rs As Stream = request.GetResponse().GetResponseStream()
Dim reader As StreamReader = New StreamReader(rs)
Dim line As String = ""
Dim sb As StringBuilder = New StringBuilder()
While line IsNot Nothing
line = reader.ReadLine()
If line IsNot Nothing Then sb.Append(line)
End While
Dim responseString As String = sb.ToString()
Response.Write(sb.ToString())
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Function