How to handle custom keyboard responses in Telegram bot without slash prefix

I’m working on a Telegram bot and trying to capture user input from custom keyboards without requiring the slash symbol at the beginning. From what I’ve read in various discussions and official docs, commands typically need to start with ‘/’ but I’ve noticed several popular bots that seem to work differently. I’ve seen examples where bots can process regular text responses from inline keyboards just fine. I tried intercepting the message text before processing and manually adding the slash character, but that approach didn’t work out. Has anyone found a working solution for this? I’m building my bot using PHP and would appreciate any suggestions or alternative approaches.

Here’s the thing - custom keyboard responses aren’t commands, they’re just regular messages. When someone taps a button on your keyboard, Telegram sends it as normal text to your bot. Handle these in your message processing, not your command handler. In PHP, I check incoming messages against expected keyboard responses first, then fall back to commands if there’s no match. I keep an array of valid keyboard responses and check the message text against those before trying to parse commands. Works great and you don’t need to mess with slashes.

just forget the slash tbh. use webhooks or getUpdates to handle messages directly. inline keyboards can send normal text, so just catch em in your main msg handler instead of treating em like commands.

You’re mixing up two different things here. Custom keyboard buttons and inline keyboard callbacks work totally differently from slash commands. When users tap custom keyboard buttons, those get processed as regular text messages through your normal message handler - not the command router. I hit this same confusion when I started with Telegram bots. The fix is setting up a state management system to track what keyboard you sent each user, then match incoming text against expected button values. For PHP, I usually use session storage or a simple database table to track user states and expected responses. Once you separate keyboard handling from command processing, everything clicks and you won’t need slash workarounds.