I have send poll by my bot in private chat with a bot. Poll appeared fine. But when I answer it - telegram server repeat sending message to web hook:
{"update_id":199522750, "poll":{"id":"5276163750276104310","question":"Question?","options":[{"text":"test1","voter_count":0},{"text":"test2","voter_count":1},{"text":"test3","voter_count":0}],"total_voter_count":1,"is_closed":false,"is_anonymous":true,"type":"regular","allows_multiple_answers":false}}
Webhook receives it every minute. I have deleted message with poll. How to stop this messages? Some "confirm" answer to server needed I guess.
I need to receive result once, and stop a poll. This is private chat with bot, nobody else will answer a poll.
It`s needed to store poll id, message id, chat id from sendPoll return data. Then in webhook call stopPoll and process an answer, using poll id as a key to restore other parameters(a db table with primary key pollId)
$params = [
'chat_id' => $pollRow['chat'],
'message_id' => $pollRow['message']
];
$URL = $TgAPI.'bot'.$bot['token'].'/stopPoll';
$ch = curl_init($URL);
curl_setopt_array($ch, array(
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $params,
CURLOPT_TIMEOUT => 60
));
$output = curl_exec($ch);