slack

Slack Notification for Python try, except method

Slack Notification for Python try, except method Question: I am trying to write a python code with the try and except method where anytime an exception occurs it should give me a slack notification with the exception occurred. Here is the code that I have written: try: with MailBox(‘imap.gmail.com’).login(username, password) as mailbox: print(mailbox) except Exception …

Total answers: 1

Using custom decorators with Slack Bolt Python SDK

Using custom decorators with Slack Bolt Python SDK Question: Is it possible to use my own python decorators with the Bolt SDK? I tried the code below, and it’s not working: @it_platform @app.command("/help") def action_help(): # * Log to Cloudwatch logging.info("The user triggered the command /help") I’m getting the error Unhandled request ({‘type’: None, ‘command’: …

Total answers: 1

How to iterate through a slack api response and save as local variable?

How to iterate through a slack api response and save as local variable? Question: I’m trying to make a slack app and am struggling to save part of an api response as a local variable. This is my code: import os import re import time from dotenv import load_dotenv from slack_bolt import App from slack_bolt.adapter.socket_mode …

Total answers: 1

How to send message to a Slack channel in Python

How to send message to a Slack channel in Python Question: I need to send out message to a Slack channel with Python. My Google search (here) and search from Stack Overflow (here) results in little help. What is the right way to get it working? The closest guide I found is from Slack official …

Total answers: 1

Use FastAPI to parse incoming POST request from Slack

Use FastAPI to parse incoming POST request from Slack Question: I’m building a FastAPI server to receive requests sent by slack slash command. Using the code below, I could see that the following: token=BLAHBLAH&team_id=BLAHBLAH&team_domain=myteam&channel_id=BLAHBLAH&channel_name=testme&user_id=BLAH&user_name=myname&command=%2Fwhatever&text=test&api_app_id=BLAHBLAH&is_enterprise_install=false&response_url=https%3A%2F%2Fhooks.slack.com%2Fcommands%BLAHBLAH&trigger_id=BLAHBLAHBLAH was printed, which is exactly the payload I saw in the official docs. I’m trying to use the payload information to …

Total answers: 1

Python Pandas and Slack Webhooks Requests.post

Python Pandas and Slack Webhooks Requests.post Question: What im looking to achieve is pulling a csv file from a workorder app that we use. Then convert it using pandas and remove unnecessary columns. Then post this info into slack using a webhook. I dont have access to the slack API. So far this is what …

Total answers: 1

Slack Bot – Python slack send markdown messages

Slack Bot – Python slack send markdown messages Question: I’m trying to send markdown messages in slack using SlackBot but I’m unable to find the documentation, All I got is this: response = client.chat_postMessage( …: channel=’#testing-bot’, …: text=”Hello world! <@USerID> nn – a n-b” …: …: ) I want to send MArkdown MEssages, instead of …

Total answers: 2

Python can't find installed module ('slackclient')

Python can't find installed module ('slackclient') Question: I am trying to build a slack bot for learning purpose but when I run the script get this error ModuleNotFoundError: No module named ‘slackclient’ I tried install and uninstall and then re-install with python -m pip install slackclient import os import time import re from slackclient import …

Total answers: 4

How to mention user in slack.client

How to mention user in slack.client Question: This might be a simple question, but I can not get it work. I am using Slack Python Api to mention a user in a channel, and I am referring to the document here, https://api.slack.com/methods/chat.postMessage, and my code is simple as, from slackclient import SlackClient sc = SlackClient(token) …

Total answers: 2