Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram Bot send Message to bot

I have programmed a telegram bot. This works fine when sending to groups or to users. However I do a special requirement. I need to be able to send to another bot. When adding both bots to a group as administrators. I still cannot receive the message with my second bot. I only see it with my real user account, that is added to this group. What am I missing? I used OKHttp to send the message

            Request request = new Request.Builder()
                .url("https://api.telegram.org/bot"+telSetup.getToken()+"/sendMessage?chat_id="+lAdr+"&parse_mode=HTML&text="+strMessage)
                .build();
            client.newCall(request).enqueue(new MyIPProcessing(request.toString()));

and

        if (response.message().equals("OK")){
            List <String> lStr=response.request().url().encodedPathSegments(); 

...

to receive messages ... which basically works for communication with "real users".

Any ideas welcome ....

like image 635
RG01 Avatar asked Dec 03 '17 11:12

RG01


2 Answers

According to Bots FAQ

Bots talking to each other could potentially get stuck in unwelcome loops.
To avoid this, we decided that bots will not be able to see messages from other bots regardless of mode.

like image 193
Sean Avatar answered Sep 29 '22 21:09

Sean


You can connect 2 (or more) bots with a private channel!

Just prompt the bots as admin in the channel.

Then when a bot send a post to the channel, other admin bots can see the message/file/...

like image 44
علیرضا Avatar answered Sep 29 '22 19:09

علیرضا