Comments (5)
Hey @angrychimp, is there a reason you are not using the files_upload_v2
method the SDK provides? It wraps up this entire song-and-dance of making the getUploadURLExternal
call, POSTing to the upload URL, and then calling completeUpload
.
Here's my Python app code:
resp = client.chat_postMessage(channel=body["channel_id"], text="gonna post a file in thread here shortly")
client.files_upload_v2(
channel=body["channel_id"],
snippet_type="text",
alt_text="sample file",
filename="file.txt",
content="things,stuff\nbits,bobs\n",
thread_ts=resp["ts"]
)
And here's the result in my production workspace:
![Screenshot 2024-05-29 at 8 38 46 AM](https://private-user-images.githubusercontent.com/52645/334801031-24a7e29d-a1e0-4a64-8bab-dc5b73157ed3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg3NzkzNjEsIm5iZiI6MTcxODc3OTA2MSwicGF0aCI6Ii81MjY0NS8zMzQ4MDEwMzEtMjRhN2UyOWQtYTFlMC00YTY0LThiYWItZGM1YjczMTU3ZWQzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE5VDA2Mzc0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI4Yzg0N2VlOTE4OWY0ZjU2MDQ2ODMyZjEzOWY2ZDE0ZmVlNTQyODk0YzAxN2FlNWQxYWQzYWEyOTZhZThiY2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Z_OYJ3aSy_KEDnKNaF3tVKTBiZEMJjCnd3em07whn1w)
from python-slack-sdk.
Thanks - I was looking at the API reference and did not see anything for the new files_upload_v2
, and did not think to look at the SDK docs.
Using this new method seems to work just fine. I appreciate the help.
from python-slack-sdk.
Related Issues (20)
- Unpredictable behaviour using .files_upload_v2 HOT 3
- websocket_client-based SocketModeClient does not reconnect after a DNS outage HOT 1
- ModuleNotFoundError: no module named 'slack' HOT 14
- client.files_upload_v2 complains about channel not found but client.files_upload works. HOT 4
- `RichTextElement.elements` items are never promoted to a proper Python object type HOT 4
- Slack WebClient Proxy Error HOT 3
- Duplicated Messages from Bot Deployed on Vercel HOT 1
- Last Bullet List Item Not Displayed on iOS Devices HOT 2
- Why we don't use certifi root certificates by default? HOT 7
- API Cursor Pagination Performance : conversations.list HOT 3
- Method Argument Alignment: chat.postMessage, chat.update HOT 2
- Async client uses blocking call when uploading file with v2 HOT 1
- Error occurred while updating the thread in slack: 'file' HOT 1
- When sending a message with metdata through the API as a bot, the metadata.event_payload is not returned HOT 2
- Need a method to get the channel ID using the current channel name HOT 2
- How can I read messages using the WebClient? HOT 5
- `CheckboxesElement` within `ActionsBlock` silently fails to render when `initial_options` does not exactly match a given `Option` in the element's `options` list HOT 2
- Add `Options` / `initial_options` validation
- Slack API returning error when trying to Update a message containing an image blocks element HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-slack-sdk.