How can I restrict my Telegram bot to work only in groups?

I have a Telegram bot that uses a webhook to search through files hosted on my server and returns links with search results. Currently, the bot responds in both private and group chats. I want to modify its settings so that it only works in group conversations, completely ignoring any requests that come through personal chats. How can I achieve this configuration change to disable its functionality in one-on-one chats?

To restrict the bot to groups, check the chat type of every update the webhook provides. In your bot’s code, verify that the chat type is either group or supergroup before running any functions. This approach prevents the bot from taking any action in private messages. For example, if you are using Node.js, include a simple conditional statement in the update handler that exits early if the chat type is not recognized as a group. This strategy has worked reliably in my experience and avoids the overhead of processing unwanted messages.