Skip to content

Instantly share code, notes, and snippets.

@thermatk
Created April 11, 2018 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thermatk/7f87c173ba80bcb6efd0fca1bb420520 to your computer and use it in GitHub Desktop.
Save thermatk/7f87c173ba80bcb6efd0fca1bb420520 to your computer and use it in GitHub Desktop.
Dim objRequest As Object
Dim strChatId As String
Dim strMessage As String
Dim strPostData As String
Dim strResponse As String
strChatId = "chatid"
strMessage = "HelloWorld"
strPostData = "chat_id=" & strChatId & "&text=" & strMessage
Set objRequest = CreateObject("MSXML2.XMLHTTP")
With objRequest
.Open "POST", "https://api.telegram.org/bot448817313:AAEwx3JKqx7ORbyUxlWMlYRzZUXxSeF_dhA/sendMessage?", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send (strPostData)
GetSessionId = .responseText
MsgBox GetSessionId
End With
@thermatk
Copy link
Author

thermatk commented Sep 2, 2018

  • register bot: @BotFather
  • send some messages to the bot (establish a chat dialogue)
  • get chat_id: https://api.telegram.org/bot<token>/getUpdates
  • get bot info: https://api.telegram.org/bot<token>/getMe
  • modify chatid and token accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment