Can a Telegram bot send messages to another bot?

Hey everyone, I’m stuck with a Telegram bot issue. My bot works fine sending messages to groups and users, but I can’t get it to talk to another bot. I’ve tried adding both bots as admins in a group, but my second bot doesn’t receive the message. Only my real user account in the group sees it.

Here’s a simplified version of my code:

val request = Request.Builder()
    .url("https://api.telegram.org/bot$token/sendMessage?chat_id=$chatId&text=$message")
    .build()
client.newCall(request).enqueue(MessageCallback())

// Handling response
if (response.isSuccessful) {
    val segments = response.request.url.pathSegments
    // Process segments
}

This works for regular users, but not bot-to-bot. Any ideas what I’m doing wrong or if this is even possible? Thanks!

nah, bots can’t chat directly mate. telegram blocks that to stop spam n stuff. but hey, u could try using a server in between. like, bot1 sends to server, server sends to bot2. bit more work but it gets the job done. just keep ur server safe from hackers n all that. good luck!

From my understanding, Telegram doesn’t allow direct bot-to-bot communication for security reasons. This is to prevent potential abuse or automated spam networks. However, there’s a workaround you might consider.

Instead of trying to make your bots communicate directly, you could set up a middleware server. This server would act as an intermediary, receiving messages from one bot and then forwarding them to the other using the Telegram API. It adds an extra step, but it’s a reliable method to achieve what you’re after.

Remember to implement proper security measures on your server to prevent unauthorized access. This approach has worked well in my projects, allowing for more complex bot interactions while staying within Telegram’s guidelines.

I encountered a similar situation with Telegram bots. In my experience, bots are designed so that they cannot communicate directly with each other, which is a security measure to prevent misuse.

A workaround is to use an intermediary server. Instead of making bots talk directly, one bot sends a message to this server, the server processes it, and then it uses the Telegram API to send the message to the other bot. Although this method adds extra steps, it does enable communication between bots indirectly. Just ensure that your server is properly secured to avoid unauthorized access.

I hope this helps.