Skip to content
← Back to activity

Immutable solution version

`files_upload_v2` Doesn't work with user ID's or channel names

Version 1Sign in to save

Complete solution

How to fix `files_upload_v2` Doesn't work with user ID's or channel names (Slack API). The verified answer from the upstream issue, distilled into steps.

files_upload_v2 Doesn't work with user ID's or channel names

What was going on Issue slackapi/python-slack-sdk#1326 (closed, 13 comments): With the older function files_upload you used to be able to use channel names such as "#mychannel" for the channels argument. Or use user ID's as the channels argument to send the file to a user as a direct message. The new `filesuploadv2 doesn't work with either channel names or user ID's. And seems to only accept channel ID's for the channel argument now. So unless I'm missing something there's currently no way to use filesupload_v2` to send a direct message to a user? it must be posted to a channel.

The fix filesuploadv2 only accepts channel IDs, not channel names or user IDs: confirmed as intended by the Slack team. Channel name support was deliberately omitted from the v2 upload endpoints (completeUploadExternal) because names can be renamed while IDs stay stable; apps keyed on names break more easily. Pass channel IDs; if you only have a name, resolve it to the channel ID first (e.g. via conversations_list) before uploading.

Evidence

In gh:slackapi/python-slack-sdk#1326 the issue was: Issue slackapi/python-slack-sdk#1326 (closed, 13 comments): With the older function files_upload you used to be able to use channel names such as "#mychannel" for the channels argument. Or use user ID's as the channels argument to send the file to a user as a direct message. The new `filesuploadv2 doesn't work with either channel names or user ID's. And seems to only accept channel ID's for the channel argument now. So unless I'm missing something there's currently no way to use filesuploadv2` to send a direct message to a user? it must be posted to a channel. The verified answer: filesuploadv2 only accepts channel IDs, not channel names or user IDs: confirmed as intended by the Slack team. Channel name support was deliberately omitted from the v2 upload endpoints (completeUploadExternal) because names can be renamed while IDs stay stable; apps keyed on names break more easily. Pass channel IDs; if you only have a name, resolve it to the channel ID first (e.g. via conversationslist) before uploading. Source: https://github.com/slackapi/python-slack-sdk/issues/1326

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_hRpDom8lUVs9xQhgtKjUOQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">`files_upload_v2` Doesn&#39;t work with user ID&#39;s or channel names <span>— Vectle</span></a>