I have a Viber channel where I want to create a weekly poll every Saturday to ask for attendance confirmation from the participants. The poll will have two options, "present" and "absent." I want to automate this process using Python. I have some knowledge of Python and I have the token of my Viber channel. However, I have not been able to send a simple message to my channel. Can someone please guide me on how to create a poll on my Viber channel using Python and send a message to the channel?
When I was researching the problem, I hadn't found endpoints in the API to create polls (ref: https://developers.viber.com/docs/api/rest-bot-api/).
The only workaround I've discovered is to simulate manual user actions via some library. I'm using Linux, it has Viber desktop client and I picked PyAutoGUI
The code looks like:
import pyautogui
pyautogui.moveTo(base_x+group_x, base_y+group_y)
pyautogui.click()
pyautogui.moveTo(base_x+title_input_x, base_y+title_input_y)
pyautogui.click()
pyautogui.write('Pole title')
# and so on
# pyautogui.position() is useful to show current mouse coordinates
I haven't managed to run it fully automatically at the server, so I have to call it each time manually and even change some coordinates.
P.S. if you have an opportunity, take a look at some alternative messengers, e.g. Telegram has more API possibilities.