Survey and Poll Bot Implementation in Mobile Applications
A Telegram bot with a survey looks simple: question → answer options → next question. But when you need to manage these surveys from a mobile application — create questions, view results in real-time, build audience segments — the task becomes more interesting.
What the Mobile Application Does in This Scheme
The application is a control panel for the survey creator. End users complete the questionnaire through a bot (Telegram, WhatsApp Business API, or a custom chat), while the operator through the mobile interface:
- creates questions with types (single choice, multiple choice, open text, rating scale)
- publishes the survey to the right channel or sends to specific segments
- observes incoming responses in real-time
- exports results
A JSON schema is convenient for storing the survey structure. Each question is an object with id, type, text, optional options[] and next_question_id (for branching). The mobile constructor edits this JSON and saves it through the API.
// Android, editing a question in RecyclerView
data class SurveyQuestion(
val id: String = UUID.randomUUID().toString(),
val type: QuestionType, // SINGLE, MULTIPLE, TEXT, RATING
val text: String,
val options: List<String> = emptyList(),
val nextQuestionId: String? = null // null = next in sequence
)
// ViewModel saves through coroutines
fun saveQuestion(question: SurveyQuestion) {
viewModelScope.launch {
val result = surveyRepository.upsertQuestion(surveyId, question)
_uiState.update { it.copy(savedQuestion = result) }
}
}
Results arrive through WebSocket or polling every 30 seconds. On Flutter, StreamBuilder is convenient on top of Stream.periodic with requests to /surveys/{id}/responses.
Response Collection and "Live" Analytics
While the survey is active, the response counter updates in real-time. For the organizer, it's important to see: how many have already answered, distribution across options right now.
For single/multiple choice — horizontal bars with percentages (fl_chart BarChart). Bars are rebuilt on each new response — not completely, but through AnimatedController with smooth transition to the new width value. Sharp jumps on the UI annoy, especially with a fast stream of responses.
For open text responses — a scrolling list with authorship (anonymous or with name — depends on survey settings) and the ability to mark certain responses as "key" (operator taps a star, the response is pinned to the top).
Question branching in the survey — next_question_id — affects analytics too: different users saw different questions. The dashboard should show "N out of M answered" for each question, not the total number of respondents.
Response visualization: for single/multiple choice — horizontal bars (fl_chart BarChart), for rating scale — average value with distribution, for open responses — list of latest N with ability to mark as "significant".
What's Included in the Work
- Survey constructor: adding/editing questions, drag-and-drop ordering
- Distribution management: audience selection, scheduling (immediately or by time)
- Results dashboard with charts for each question
- Push notifications about survey completion or threshold achievement
- Export to CSV/Excel
Timeline
3–5 business days depending on constructor complexity and number of question types. Pricing is calculated individually after requirements analysis.







