poll #

Poll

Layer 223

poll#58747131 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:TextWithEntities answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;

Parameters #

NameTypeDescription
idlongID of the poll
flags#Flags, see TL conditional fields
closedflags.0?trueWhether the poll is closed and doesn't accept any more answers
public_votersflags.1?trueWhether cast votes are publicly visible to all users (non-anonymous poll)
multiple_choiceflags.2?trueWhether multiple options can be chosen as answer
quizflags.3?trueWhether 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_answersflags.6?trueWhether users can add new answer options after the poll is created, see open-answer polls »
revoting_disabledflags.7?trueIf set, users cannot change their vote after casting it
shuffle_answersflags.8?trueWhether answer options are displayed in a randomized order to each user
hide_results_until_closeflags.9?trueWhether vote results are hidden from all participants until the poll is closed
creatorflags.10?trueWhether the current user created this poll
subscribers_onlyflags.11?trueWhether 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 ».
questionTextWithEntitiesThe question of the poll (only Premium users can use custom emoji entities here).
answersVector<PollAnswer>The possible answers (2-poll_answers_max), vote using messages.sendVote.
close_periodflags.4?intAmount 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_dateflags.5?intPoint 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_iso2flags.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.
hashlongHash for use with messages.getPollResults

Type #

Poll

inputMediaPoll #

A poll

Polls and quizzes #

Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.

Telegram Premium #

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.

Custom emojis #

Telegram allows including animated and static custom emojis inside of messages.

Client configuration #

The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.

messages.sendVote #

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.

messages.getPollResults #

Get poll results