You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried listening for star_added events, but when I star a message within Slack, the intended debug message doesn't get printed out.
from slackclient import SlackClient
class LikeBot(SlackClient):
# Create bot instance
def __init__(self, token):
SlackClient.__init__(self, token)
self.connect_rtm()
self.server.join_channel('#bot-test')
# Connect to Slack's RTM API
def connect_rtm(self):
print 'Likebot connecting to RTM API...' #DEBUG
if self.rtm_connect():
print 'Likebot connected!' #DEBUG
else:
print 'Likebot failed to connect!' #DEBUG
# Begin listening for JSON formatted RTM API messages/events
def listen(self):
print 'Likebot Listening...' #DEBUG
while True:
for event in self.rtm_read():
# do something with RTM API event
print event # DEBUG; Fails to print a `star_added` event
if event.get('type') == 'star_added':
print True
if __name__ == '__main__':
bot = LikeBot('foo_token')
bot.listen()
The text was updated successfully, but these errors were encountered:
In order to receive star_added events, you'd need to connect with a token that has client scope, and you'd only be able to receive star actions for the user that token is associated with.
You may want to consider using the Events API, instead, as you'll have more granular control over what events you receive and the authenticating user will have a better idea what your app has access to.. You can see an example Flask app that @karishay put together here: https://github.com/slackapi/Slack-Python-Onboarding-Tutorial
I tried listening for star_added events, but when I star a message within Slack, the intended debug message doesn't get printed out.
The text was updated successfully, but these errors were encountered: