slack-api

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

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 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 upload files to slack using file.upload and requests

How to upload files to slack using file.upload and requests Question: I’ve been searching a lot and I haven’t found an answer to what I’m looking for. I’m trying to upload a file from /tmp to slack using python requests but I keep getting {“ok”:false,”error”:”no_file_data”} returned. file={‘file’:(‘/tmp/myfile.pdf’, open(‘/tmp/myfile.pdf’, ‘rb’), ‘pdf’)} payload={ “filename”:”myfile.pdf”, “token”:token, “channels”:[‘#random’], “media”:file …

Total answers: 3

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