Slack Python Api Delete Message
I am trying to use my bot to delete certain messages in a slack channel with this api call
import os import time import re from slackclient import SlackClient slack_client = SlackClient( 'xsssssseeeeeeee') slack_mute_bot_id = None def delete_message(slack_event): for event in slack_event: if event["type"] == "message": message_text = event['text'] time_stamp = event['ts'] channel_id = event['channel'] slack_client.api_call( 'chat.delete', channel=channel_id, ts=time_stamp, as_user=True ) print(message_text + " delted") if __name__ == "__main__": if slack_client.rtm_connect(with_team_state=False): slack_mute_bot_id = slack_client.api_call("auth.test")["user_id"] while True: # print(slack_client.rtm_read()) delete_message(slack_client.rtm_read()) time.sleep(1) else: print("Connection failed. Exception traceback printed above.")
I do not get any error message after doing this and the bot does not delete the message. I am using the bot user token. I have benn able to send message succesfully but the delete method does not work and still gives np responses
When used with a user token, this method may only delete messages that user themselves can delete in Slack.
When used with a bot token, this method may delete only messages posted by that bot.
I got stumbled into the same thing.
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module