2

I am part of a social science research team where we run field surveys using very limited resources (i.e. we don't have the resources to design our own apps). In many cases our surveys take place in areas with unreliable internet connectivity so Google Forms and similar online solutions aren't very useful.

We have been working using hard copy forms until now, but I would like to try implementing a Telegram bot that can allow surveyors to enter data in the field. That should be easier and more reliable even with connectivity issues - it isn't that connectivity is simply unavailable, it is just unreliable. The surveyor would fill in or choose the answer to each question in a chat with the bot.

It seems like Telegram polls are the best way to do this - especially since our surveys are often multiple choice - but I cannot figure out how to get a Telegram poll to have more than one question in it. Oddly enough this seems to be possible for Telegram quizzes but not for polls. This question implies that the bot would have to implement its own logic to ask a new poll for each question in the survey, which I can do, but which is less convenient and potentially less reliable than a multi question poll.

Is a multi question poll possible in Telegram? If so, could someone point me to the relevant documentation?

ShankarG
  • 1,105
  • 11
  • 26
  • Questions asking "Is there a way to do X?" / "Can I do X?" / "Is it possible to do X?" are rarely appropriate for the Stack Exchange format. The answer is usually "yes", but sometimes "no". Either way, the question is usually not very effective. In addition, what is usually meant is "How can I do X?", which will often, but not always, be too broad for Stack Overflow. Please [edit] your question to clarify what it is you want. Right now, this is a "yes"/"no" question. Please see: [Why is “Is it possible to…” a poorly worded question?](//softwareengineering.meta.stackexchange.com/q/7273) – Makyen Dec 28 '21 at 16:49
  • Yes, it's possible. I've created a Telegram Quiz bot that sends multiple questions in groups (at specified times) and private chat. You can check it out here: (Group) https://t.me/QuizPortal (Bot Link) https://t.me/QuizSet_bot –  Dec 28 '21 at 16:43

1 Answers1

0

Telegram provides the support for creating and processing a single question, but it is the responsibility of the developer to implement the logic around the questions:

  • calculating a score out of X questions
  • increase complexity question after questions
  • terminate the poll (after X questions).

You need to implement a backend that tracks each user (imagine a Map mapping user Id with questions and score) to be able to run your workflow, let's look at an example.

The command /start will kick off the Poll: in the backend the CommandHandler will store the user id in a Map and send out the first question.

After the user response the PollHandler will record the answer (ie question number 1, correct, score 10) and send out the next question.

The PollHandler again will record the answer (ie question number 2, correct, score 20), and so on.

At some point (ie after 5 questions) you decide that Poll is completed: the Bot will send out a final message (Your score is 30, would you like to play again?).

Some considerations:

  • this approach works fine for Simple Poll without a complicated conversation flow (in this case you would need to consider some framework to be able to support complicated workflow)
  • I have used the approach above to implement my World Capitals chatbot where I preferred using predefined options for the answers (simplify the conversation flow).
Beppe C
  • 11,256
  • 2
  • 19
  • 41
  • You can also create Telegram Bot without coding using PollBot or QuAnBot, see Telegram doc (https://telegramguides.com/create-telegram-polls/) – Beppe C May 16 '21 at 14:18