You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upload a file with [files_upload](https://api.slack.com/methods/files.upload).
174
+
###### New Method
175
+
176
+
Upload files with [sequenced API calls](https://api.slack.com/messaging/files#uploading_files).
177
+
178
+
This library provides a helper method `files_upload_v2` that wraps the three separate API calls.
179
+
180
+
```ruby
181
+
contents =File.read('/users/me/results.pdf')
182
+
client.files_upload_v2(
183
+
# required options
184
+
channels:'C000000,C000001', # comma delimited channel ids, only one channel is required
185
+
filename:'results.pdf', # this is used for the file title, unless a :title option is provided
186
+
contents: contents, # the string contents of the file
187
+
188
+
# optional options
189
+
initial_comment:'Sharing the Q1 results :tada:', # the message that is included with the file share thread
190
+
snippet_type:'text', # the type of snippet
191
+
title:'Q1 Results', # sets the title of the file, overriding the filename
192
+
thread_ts:'1738331487.481469'# specifies a thread to add this file to
193
+
)
194
+
```
195
+
196
+
###### Legacy Method
175
197
176
198
```ruby
177
199
client.files_upload(
@@ -184,6 +206,8 @@ client.files_upload(
184
206
)
185
207
```
186
208
209
+
The client.files_upload uses a deprecated endpoint `files.upload` that will [no longer be supported on 3/11/2025](https://api.slack.com/methods/files.upload#markdown).
210
+
187
211
##### Get Channel Info
188
212
189
213
You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API and the `channels_id` method called invokes `conversations_list` in order to locate the channel ID. This invocation can have a cost if you have many Slack channels. In this scenario, we encourage you to use channel id.
0 commit comments