My slack channel supports the /poll command from the Simple Poll app. How do you call this command using the Slack API?
Using the python slack (er) API module :
from slacker import Slacker # Using what now called a "legacy token" slack = Slacker('my-token') slack.chat.post_message( '#test', '/poll "Do you prefer cats or dogs?" "Cats" "Dogs"', as_user=False, username="Poll Bot", icon_emoji=':question:', parse='full')
The message is simply displayed in the #test channel as plain text, and is not converted to a survey.
I tried using <!poll> instead of /poll in the message, as a kind of implicit message formatting alert , but the same result.
Note. This question is a bit outdated, and after the review, I found out that my code uses what is now called the legacy token , which does not allow me to specify any OAuth scopes . An outdated token already has the permissions necessary for this case.
python slack-api slack
Civfan
source share