Telegram bot not responding to commands sent from Android application

Hi everyone,

I’m having trouble with my Telegram bot setup. I built a bot using BotFather and created an Android app to send commands through buttons. The issue is that when I press a button in my app, the command appears in the bot chat but nothing happens. However, if I manually enter the same command within the chat, it works perfectly.

Both my Android app and my account use the same API token and chat ID.

Here’s how my project is structured:

  • Telegram bot triggers on the command “/hello”
  • The APK agent responds with “Welcome” when it detects “/hello”
  • A new APK controller sends the command by clicking the button

When I click the button, " /hello" shows up in the chat, but the agent APK fails to respond with “Welcome”. It seems that the command sent from my app isn’t being accepted despite using the correct API token and chat ID.

What can I do to ensure that commands sent from my Android app are recognized as valid, just like those typed directly in the chat?

This sounds like a message entity parsing issue. When you type commands manually, Telegram creates bot_command entities that help your bot recognize them. But when you’re sending through the API from your Android app, you need to explicitly format the message as a command or include the entities parameter. Try using the entities field in your sendMessage request to mark your text as bot_command type. Your bot code might also be filtering messages based on message type or user verification. Check if your bot handler is looking for message.text versus message.entities - API-sent messages might have different properties than user-typed ones.

Had the same problem with my Telegram bot. Your Android app and bot are probably handling messages differently. When you type manually, Telegram sends proper user metadata, but your app might be missing headers or formatting the bot expects. Double-check you’re using the right sendMessage endpoint and verify your message format. Also make sure your bot’s webhook or polling is set up correctly for your chat ID. I had to tweak my bot’s message parsing to handle both manual typing and app sends the same way. Add some debug logging to see what your bot actually receives from the Android app.

your android app’s probably sending msg with a differnt user context than when u type manually. check if the msg sender ID matches ur actual telegram user ID when it’s sent from the app. also make sure ur bot’s listening for msgs from the right chat - apps sometimes send from differnt sender contexts even with the same token.