Sending Telegram messages via Elipse E3/Elipse Power.

This article shows you how set up your Telegram app to send messages via Elipse E3/Elipse Power with Elipse VBScript driver.

Requirements:

To send messages at Telegram app via an Elipse E3 or Elipse Power application, you will need to:

  • Install Telegram and create an account.
  • Create a Telegram bot, which will work as your account for sending messages via E3/Power.
  • Identify the API/Token and ChatID for sending messages.
  • Use a Elipse VBScript driver and JSON code for sending messages.

Introduction:

1. Once Telegram has already been installed and set up in your smartphone, start a conversation with @BotFather:

 

2. To do so, click Start above the keypad, and as soon as all options are displayed, click or type “/newbot”:

 

3. Then, create a name for your bot:

NOTE: This username must contain the word “bot”; for example: ElipseSoftwareBOT or ElipseSoftware_BOT

4. You will receive a message with two important pieces of information: the link to open your chat with the bot, and the API/token that identifies the user sending the message. Copy this token to use at the next step of these settings.

Starting a chat:

1. Firstly, access the previous link to create a chat with the newly created bot; after that, click Start and send a test message:

2. Access a browser and then use the link below, making sure you will replace the crossed out token with the one you saved on the previous section; this will lead you to a page where you can collect more pieces of informations, among which are the open ChartID number and the received message:

https://api.telegram.org/bot743025931:AAF_JgmU-WCM13Mk5avBGn0cNVTNBcB0y_8/GETupdates


3. Copy the ChartID for further use in sending Elipse E3/Power messages.

 

Using Telegram with Elipse E3/Elipse Power:

1. At Elipse E3/Power, we will use the VBScript driver with a JSON structure; to do so, add the lines below:

Dim vChatID, vText, vToken
Sub OnWrite_ChatID(r, v)
vChatID= v.Value
End Sub
Sub OnWrite_Text(r, v)
vText = v.Value
End Sub
Sub OnWrite_Token(r, v)
vToken = v.Value
End Sub
Sub OnWrite_SendMsg(r, v)
URL = "https://api.telegram.org/bot"&vToken&"/SendMessage?chat_id=" & vChatID & "&text=" & vText
Dim oJsonParser
Set oJsonParser = new aspJSON 'Creates aspJSON object 
oJsonParser.LoadJSON(URL)
End Sub

2. For further information on JSON code, check the article Consuming and sending data from a JSON web service.

3. Then, create four new tags in the driver and set them up through  Item (ParamItem property) and Allow Read (AllowRead property) columns, according to the figure below:

4. Finally, write the data from Token, CharID and Text to be sent; after that, write any value at SendMsg tag.

Attachment:

Demo application: ExTelegram.zip

 

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *