KB-113757: Sending E3 messages to a Telegram group via BOT.

This article illustrates how to send Elipse E3/Elipse Power messages via a BOT to a group in Telegram app.

First of all, you must create a BOT. For the purposes of this article, we will consider the BOT has already been created, according to the procedures at Sending Telegram messages via Elipse E3/Elipse Power. After that, follow these steps:

1. Firstly, ask the group’s creator/admin to add the BOT to the group.

2. Then, send a test message to the group. For example:

3. After that, in your browser, get a list of updates for your BOT:
https://api.telegram.org/bot/getUpdates

For example:
https://api.telegram.org/bot3294991797:AAFUrfZFoO4ezUc7IZAGY-B1jTWNFbGmJh0/getUpdates

4. Subsequently, search the received message for the last “chat” object:

{“update_id”:96441558,”message”:{“message_id”:42,”from”:{“id”:1398492514,”is_bot”:false,”first_name”:”D\u00e9lio”,”last_name”:”Damin”,”language_code”:”pt-br”},”chat“:{“id”:-175560695,”title”:”Teste_Elipse”,”type”:”group”,”all_members_are_administrators”:true},”date”:1610733225,”new_chat_participant”:{“id”:1294991797,”is_bot”:true,”first_name”:”Delio Elipse”,”username”:”DelioElipseBOT”},”new_chat_member”:{“id”:1294991797,”is_bot”:true,”first_name”:”Delio Elipse”,”username”:”DelioElipseBOT”},”new_chat_members”:[{“id”:1294991797,”is_bot”:true,”first_name”:”Delio Elipse”,”username”:”DelioElipseBOT”}

Therefore, if we format the received answer via a JSON viewer, it would look like this:

{
   "ok":true,
   "result":[
      {
         "update_id":96441558,
         "message":{
            "message_id":42,
            "from":{
               "id":1398492514,
               "is_bot":false,
               "first_name":"D\u00e9lio",
               "last_name":"Damin",
               "language_code":"pt-br"
            },
            "chat":{
               "id":-175560695,
               "title":"Teste_Elipse",
               "type":"group",
               "all_members_are_administrators":true
            },
            "date":1610733225,
            "new_chat_participant":{
               "id":1294991797,
               "is_bot":true,
               "first_name":"Delio Elipse",
               "username":"DelioElipseBOT"
            },
            "new_chat_member":{
               "id":1294991797,
               "is_bot":true,
               "first_name":"Delio Elipse",
               "username":"DelioElipseBOT"
            },
            "new_chat_members":[
               {
                  "id":1294991797,
                  "is_bot":true,
                  "first_name":"Delio Elipse",
                  "username":"DelioElipseBOT"
               }
            ]
         }
      }
   ]
}

This is a sample of the answer you get when adding a BOT to the group.

5. Finally, use the “id” of the “chat” object to send your messages.
For example:
https://api.telegram.org/bot3294991797:AAFUrfZFoO4ezUc7IZAGY-B1jTWNFbGmJh0/SendMessage?chat_id=-175560695&text=Hello!

Lastly, to use the demo application attached to this article, add your IDChat and Token information alongside the message.

For further information on the demo application, check the related article below.

Related article

 

Attachments:

Telegram.zip

Este artigo foi útil? Was this post helpful?
Yes0
No0

Leave a Reply

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