Poll
Constructor schema is available as of layer 112. Switch »
| Name | Type | Description |
|---|---|---|
| id | long | ID of the poll |
| flags | # | Flags, see TL conditional fields |
| closed | flags.0?true | Whether the poll is closed and doesn't accept any more answers |
| public_voters | flags.1?true | Whether cast votes are publicly visible to all users (non-anonymous poll) |
| multiple_choice | flags.2?true | Whether multiple options can be chosen as answer |
| quiz | flags.3?true | Whether this is a quiz (with wrong and correct answers, results shown in the return type). When creating a poll, the correct answers are specified in inputMediaPoll. correct_answers. |
| open_answers | flags.6?true | Whether users can add new answer options after the poll is created, see open-answer polls » |
| revoting_disabled | flags.7?true | If set, users cannot change their vote after casting it |
| shuffle_answers | flags.8?true | Whether answer options are displayed in a randomized order to each user |
| hide_results_until_close | flags.9?true | Whether vote results are hidden from all participants until the poll is closed |
| creator | flags.10?true | Whether the current user created this poll |
| subscribers_only | flags.11?true | Whether only subscribers can vote: a user may vote only if they are currently a member of the channel/supergroup and joined it at least 24 hours before the poll was posted, see subscriber-only polls ». |
| question | TextWithEntities | The question of the poll (only Premium users can use custom emoji entities here). |
| answers | Vector<PollAnswer> | The possible answers (2-poll_answers_max), vote using messages.sendVote. |
| close_period | flags.4?int | Amount of time in seconds the poll will be active after creation, up to poll_close_period_max » seconds. Can't be used together with close_date. |
| close_date | flags.5?int | Point in time (Unix timestamp) when the poll will be automatically closed. Up to poll_close_period_max » seconds in the future; can't be used together with close_period. |
| countries_iso2 | flags.12?Vector<string> | If set, only users from the specified ISO 3166-1 alpha-2 country codes may vote, see country-restricted polls »; a user may vote only if the phone_country_iso2 » configuration parameter is contained in this list. |
| hash | long | Hash for use with messages.getPollResults |
A poll
Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.
Telegram Premium is an optional subscription service that unlocks additional exclusive client-side and API-side features, while helping support the development of the app.
Telegram allows including animated and static custom emojis inside of messages.
The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.
Vote in a poll
Starting from layer 159, the vote will be sent from the peer specified using messages.saveDefaultSendAs.
Before voting, clients should check that the user is actually allowed to vote: voting is not possible if the poll is closed, if it is subscriber-only » and the user is not an eligible subscriber, or if it is country-restricted » and the user's phone_country_iso2 » is not in the poll's allowed country list. See vote restrictions » for the full list of conditions.
Get poll results