Skip to content

Commit 439bf88

Browse files
committed
update readme.md
1 parent 6fddc4f commit 439bf88

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,29 @@ general_channel = channels.detect { |c| c.name == 'general' }
171171

172172
##### Upload a File
173173

174-
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
175197

176198
```ruby
177199
client.files_upload(
@@ -184,6 +206,8 @@ client.files_upload(
184206
)
185207
```
186208

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+
187211
##### Get Channel Info
188212

189213
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

Comments
 (0)