Answer the question
In order to leave comments, you need to log in
How to create a poll in Telegram via API?
Good afternoon everyone. There is such a situation: mailing to groups in telegrams is done through PowerShell, the code is as follows:
$URI = "https://api.telegram.org/bot" + $token + "/sendMessage?chat_id=" + $chat_id + "&text=" + $text
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Request = Invoke-WebRequest -URI ($URI)
$token = "213"
$chat_id = @('2211', '31122', '3122')
$text = "Посмотрел?"
$options = @('Да', 'Нет')
$json = $options | ConvertTo-Json
foreach($chat_id_new in $chat_id) {
$URI = "https://api.telegram.org/bot" + $token + "/sendPoll?chat_id=" + $chat_id_new + "&question=" + $text + "&options" + $json
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Request = Invoke-WebRequest -URI ($URI)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question