<metaproperty="description"content="Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.">
<metaproperty="og:description"content="Telegram allows sending polls and quizzes, that can be voted on by thousands, if not millions of users in chats and channels.">
<p>To send a poll in a chat, call <ahref="/method/messages.sendMedia">messages.sendMedia</a>, providing an <ahref="/constructor/inputMediaPoll">inputMediaPoll</a>:</p>
<ul>
<li>
<p><code>poll</code> is the actual <ahref="/constructor/poll">poll constructor</a>, containing:</p>
<ul>
<li><code>question</code> - The poll title, aka the poll's title</li>
<li><code>answers</code> - A vector of possible answers (2-10), each with a visible title <code>text</code> , and a unique <code>option</code> identifier (1-100 bytes)</li>
<li><code>closed</code> - Whether the poll is closed</li>
<li><code>public_voters</code> - Whether cast votes are publicly visible to all users (non-anonymous poll) </li>
<li><code>multiple_choice</code> - Whether multiple options can be chosen as answer</li>
<li><code>quiz</code> - Whether this is a quiz with correct answer IDs specified in <code>inputMediaPoll.correct_answers</code></li>
<li><code>close_period</code> - Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with <code>close_date</code> .</li>
<li><code>close_date</code> - Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future; can't be used together with <code>close_period</code> . <br>
These last two parameters are exactly the same, except that one uses absolute, the other relative unixtime.</li>
<p><code>solution</code> - Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds</p>
</li>
<li>
<p><code>solution_entities</code> - <ahref="/api/entities">Styled text message entities</a> for the <code>solution</code> explanation</p>
</li>
</ul>
<p>In order to prematurely close the poll, preventing further votes, use <ahref="/method/messages.editMessage">messages.editMessage</a>, setting the <code>poll.closed</code> flag to true. </p>
<h3><aclass="anchor"href="#voting-in-polls"id="voting-in-polls"name="voting-in-polls"><iclass="anchor-icon"></i></a>Voting in polls</h3>
<p>When receiving a <ahref="/constructor/message">message</a> with a <ahref="/constructor/messageMediaPoll">messageMediaPoll</a>, users can vote in it using <ahref="/method/messages.sendVote">messages.sendVote</a>, specifying the chosen <code>option</code> identifiers. </p>
<p>The method will return an <ahref="/constructor/updateMessagePoll">updateMessagePoll</a>, containing an updated <ahref="/constructor/pollResults">pollResults</a> constructor, with the <code>chosen</code> flag set on the options we chose, and the <code>correct</code> flag set on the correct answers. </p>
<p>Regularly, if new users have voted in polls available to the user, they will receive an <ahref="/constructor/updateMessagePoll">updateMessagePoll</a>, with updated <ahref="/constructor/pollResults">pollResults</a>. </p>
<p>The same constructor can also be fetched manually using <ahref="/method/messages.getPollResults">messages.getPollResults</a>.</p>
<h3><aclass="anchor"href="#getting-poll-voters-in-non-anonymous-polls"id="getting-poll-voters-in-non-anonymous-polls"name="getting-poll-voters-in-non-anonymous-polls"><iclass="anchor-icon"></i></a>Getting poll voters in non-anonymous polls</h3>
<p><ahref="/method/messages.getPollVotes">messages.getPollVotes</a> can be used to get poll results for non-anonymous polls, to see how each user voted for a poll option.<br>
Bots will also receive an <ahref="/constructor/updateMessagePollVote">updateMessagePollVote</a> every time a user their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.</p></div>
</div>
</div>
</div>
<divclass="footer_wrap">
<divclass="footer_columns_wrap footer_desktop">
<divclass="footer_column footer_column_telegram">
<h5>Telegram</h5>
<divclass="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.