The Poll node sends a poll or a quiz to a Telegram chat. A quiz is a poll with one or more correct options: Telegram shows the user whether the answer is right and, for a wrong answer, the explanation. To learn more about Telegram polls read here.
All the texts of the Poll node support chat context templating, for example the question can be Pizza for {{firstName}}?. When the question or the options are empty in the editor, they are taken from msg.payload (see below), so the poll can be built dynamically in an upstream Function node.
The node has these options:
{{variable}}, from 5 seconds to 30 days in the future)The Parse Mode param of the Params node applies to the explanation and the description. The poll also supports the Telegram params Silent, Protect content, Allow paid broadcast, Reply to message and Message effect.
When a poll is sent, its ids are stored in the chat context: {{pollId}} and {{pollMessageId}} (the id of the message that contains the poll, also in {{outboundMessageId}}).
The answers of a non-anonymous poll arrive on the event output of the Telegram Receiver node as events with payload.eventType = "poll-answer". Use the Rules node with the rule Message is event … Poll answer to route them. For a quiz the answer has correct: true or correct: false:
{
type: 'event',
eventType: 'poll-answer',
chatId: -1001234567890, // the chat of the poll, here a group
messageId: 1000, // the message with the poll
pollId: '5800293829204',
pollType: 'quiz',
optionIds: [1],
options: ['Rome'],
correct: true,
retracted: false,
voter: { id: 196520947, first_name: 'Guido' }
}
The changes of the vote counts and the closing of the poll arrive as poll-update events. Both are described in the Telegram Receiver node page.