Creating a Telegram Bot for Anonymous Q&A in Groups

Hey everyone, I’m trying to set up a Telegram bot for anonymous Q&A in a group chat. Here’s what I’ve done so far:

  1. Made a bot that can send questions to a group where I and other admins are members
  2. Added a “Reply to this question” button in the group

The problem is, the button doesn’t work as expected. I’m wondering:

  • Is it possible for the bot to send a response from the group back to the specific user who asked the question?
  • Can this be done without revealing the asker’s user ID?
  • Are there any existing bots that can handle this kind of anonymous Q&A setup?

I’m new to Telegram bot development, so any tips or suggestions would be really helpful. Thanks in advance for your input!

hey bob, i’ve seen similar setups before. you could try using a database to store question IDs and user info. when admins reply, the bot can fetch the original asker’s info and send the response privately. this way, anonymity is maintained. it’s a bit tricky but doable with some coding. good luck!

I’ve actually implemented something similar for a community group I manage. Here’s what worked for us:

We used a combination of inline keyboards and a database to handle the anonymous Q&A. When a user sends a question to the bot privately, it generates a unique ID for that question and stores it with the user’s info in the database. The bot then posts the question to the group with an inline keyboard.

When an admin clicks the ‘Reply’ button, the bot prompts them to write a response. Once sent, the bot uses the stored ID to send the answer back to the original asker privately, maintaining anonymity.

The tricky part was error handling and ensuring message delivery, but overall it’s doable with the Telegram Bot API. Just be prepared for some trial and error during development.

Hope this helps point you in the right direction!

I’ve worked on a similar project before, and here’s what I found effective:

Instead of using buttons, consider implementing a command-based system. When an admin wants to reply, they can use a command like /reply followed by the question ID and their response. The bot can then process this command, retrieve the original asker’s information from a database, and send the reply privately.

This approach maintains anonymity and simplifies the interaction flow. It also reduces the chances of API-related issues that sometimes occur with inline keyboards.

Remember to implement proper error handling and logging to troubleshoot any issues that may arise during operation. Good luck with your project!