How to make one Telegram bot receive messages from another bot

I’m working on a Telegram bot project and ran into an issue. My bot works perfectly when it sends messages to regular users or group chats. But now I need something different - I want one of my bots to send messages that another bot can receive.

I tried putting both bots in the same group and made them both admins. The weird thing is that when my first bot sends a message, only my personal account can see it in the group. My second bot doesn’t pick it up at all.

Here’s the code I’m using to send messages:

URL apiUrl = "https://api.telegram.org/bot" + botConfig.getApiKey() + "/sendMessage";
String params = "?chat_id=" + targetId + "&parse_mode=HTML&text=" + messageText;

HttpRequest httpRequest = new HttpRequest.Builder()
    .url(apiUrl + params)
    .build();
httpClient.newCall(httpRequest).enqueue(new ResponseHandler(httpRequest.toString()));

And for receiving:

if (apiResponse.status().equals("OK")) {
    List<String> urlParts = apiResponse.request().url().pathSegments();
    // processing logic here
}

This setup works fine for talking to real users. What am I doing wrong? Is there something special about bot-to-bot communication that I’m missing?

Telegram has a fundamental limitation where bots cannot receive messages from other bots, even in group chats. This is by design in their API architecture. When your first bot sends a message to a group, other bots in that group simply won’t see it through their webhook or polling updates. I faced this exact problem last year when building a multi-bot system. The solution I ended up implementing was using a database as an intermediary. Bot A writes the message data to a shared database table, and Bot B polls this table or uses database triggers to detect new messages. You could also use Redis pub/sub or a message queue like RabbitMQ for real-time communication. Another approach is having your bots communicate through your backend API directly instead of trying to use Telegram as the messaging layer between them. The group chat approach you’re attempting simply won’t work due to Telegram’s bot restrictions.

yeah bots cant see messages from other bots in telegram, its hardcoded restriction. i use webhooks instead - set up a simple server endpoint and have bot A post data there, then bot B fetches it. works much better than trying database stuff imo

This is a common misconception about Telegram bots. The restriction mentioned by others is correct - bots cannot directly receive messages from other bots through the standard message updates. However, there’s a workaround I discovered while working on a similar project. You can create a regular user account (not a bot account) to act as a bridge between your bots. This user account can receive messages from Bot A and then forward or process them for Bot B through your backend logic. Alternatively, if you control both bots, consider restructuring your architecture so they share the same core logic but operate as different instances responding to different triggers or commands. The shared database approach works well too, but make sure to implement proper cleanup to avoid accumulating old messages. Your current code structure looks fine for regular messaging, the issue is purely architectural rather than implementation-related.