Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ApexLeo's avatar

Laravel telegram api integration

Hello Laracasts, I am having an issue to get a telegram user id of a user using his/her username. Also, there are few scenarios that I want to know is that possible or not using PHP telegram api.

  1. if we have a username of any user, can we get his/her user id from @userinfobot?
  2. can we receive messages from the user using Bot? i mean two way communication. or check if which user has join our channel etc.
  3. how to hide input field from a bot so no one can reply?
  4. how to add predefined buttons instead of an input field? like most channels groups are doing.
  5. also, if a user adds our bot can we programmatically press the join button for him?

it will be a great help if anyone can answer the questions. Thank you.

0 likes
5 replies
ApexLeo's avatar

Hi, @tisuchi thank you for your quick response. i am already doing few of these things. but it didn't answer any of my question

noelmoreno's avatar

Hi there! Integrating the Telegram API with Laravel can be a bit tricky, but fear not! To fetch a Telegram user ID using a username in PHP, consider utilizing the getChat method from the Telegram Bot API. This can help retrieve user details based on their username. Additionally, for specific scenarios, like checking if a user is in a group or obtaining chat history, explore the Telegram Bot API documentation to find methods that suit your needs. Laracasts has some excellent tutorials on Laravel and API integrations, so I recommend checking out their resources for more in-depth guidance on this matter. Happy coding!!!!!!!!! (www.gbwhatsapp.net)

Please or to participate in this conversation.