slack-ruby-client 2.5.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -0
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile +3 -0
  5. data/README.md +30 -17
  6. data/bin/commands/admin_conversations.rb +12 -1
  7. data/bin/commands/admin_users.rb +1 -1
  8. data/bin/commands/assistant_search.rb +27 -0
  9. data/bin/commands/canvases.rb +1 -0
  10. data/bin/commands/chat.rb +1 -0
  11. data/bin/commands/conversations_canvases.rb +1 -0
  12. data/bin/commands/files.rb +1 -0
  13. data/bin/commands/functions_distributions_permissions.rb +6 -4
  14. data/bin/commands/usergroups.rb +0 -1
  15. data/lib/slack/events/request.rb +2 -1
  16. data/lib/slack/messages/formatting.rb +8 -0
  17. data/lib/slack/utils/security.rb +44 -0
  18. data/lib/slack/version.rb +1 -1
  19. data/lib/slack/web/api/endpoints/admin_conversations.rb +18 -1
  20. data/lib/slack/web/api/endpoints/admin_users.rb +1 -1
  21. data/lib/slack/web/api/endpoints/assistant_search.rb +44 -0
  22. data/lib/slack/web/api/endpoints/canvases.rb +2 -0
  23. data/lib/slack/web/api/endpoints/chat.rb +2 -0
  24. data/lib/slack/web/api/endpoints/conversations.rb +0 -1
  25. data/lib/slack/web/api/endpoints/conversations_canvases.rb +2 -0
  26. data/lib/slack/web/api/endpoints/files.rb +3 -0
  27. data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +6 -2
  28. data/lib/slack/web/api/endpoints/usergroups.rb +0 -2
  29. data/lib/slack/web/api/endpoints.rb +2 -0
  30. data/lib/slack/web/api/errors.rb +34 -2
  31. data/lib/slack/web/api/helpers/files.rb +1 -1
  32. data/lib/slack/web/api/mixins/conversations.id.rb +12 -1
  33. data/lib/slack/web/api/mixins/ids.id.rb +3 -3
  34. data/lib/slack/web/api/mixins/users.id.rb +12 -1
  35. data/lib/slack/web/config.rb +4 -0
  36. data/lib/slack-ruby-client.rb +3 -1
  37. metadata +6 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26da07098b43509aec00e5ce7e280ff83b055cae435c2f13b7e7528200356191
4
- data.tar.gz: 9982a63021be02cd1caf07d6ee44d4fc5f8be64c10b6bfbadae153ed4201db59
3
+ metadata.gz: 47ff28dd66be50f30523812cdd1ab26e1910d68161fc59006e1702636667f0ff
4
+ data.tar.gz: d2419d167109916aa49308519150e673c1fde0464edd941f0912ba5b14962da4
5
5
  SHA512:
6
- metadata.gz: bf976826d6f95ed2da12a61c42fd1f18c73b8f8065dc4471723ae85c11a89b764cf0a2bd0f422c634a1206ac24e8d9c1fdb68b25a5eeb93fd0957ee1094bd470
7
- data.tar.gz: 9ac701bc529f369b2051d70afeedcbc05305740199fd03dd572749ff28d9df8d73c7e583e26fafc7c757b74d631c4bca3d3f73970e2571dc52c7fa925d4a1a3c
6
+ metadata.gz: 33ffb3d98c4e8445757bc1c457df69ddd1e67035dddd51c25f50dbf1c970cce4ec71af655ccc22b4e02e12ee73bbac7d2e5ba09f5795616270b83ec346743a80
7
+ data.tar.gz: 0cfcfa4746617cccb864c533dd62455d6ce058632b0293febfff7357fbf77610298a008ff52b52caaea2d857c4a162202b8e0a0f1deea0ea29a1232222653a4d
@@ -41,6 +41,7 @@ jobs:
41
41
  parallel: true
42
42
  github-token: ${{ secrets.GITHUB_TOKEN }}
43
43
  flag-name: run-${{ matrix.entry.ruby }}${{ matrix.entry.concurrency && '-'}}${{ matrix.entry.concurrency }}
44
+ allow-empty: ${{ matrix.entry.ignore || false }}
44
45
 
45
46
  finish:
46
47
  name: coveralls
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ### 2.6.0 (2025/05/24)
2
+
3
+ * [#549](https://github.com/slack-ruby/slack-ruby-client/pull/549): Add group ID formatting support for message mentions - [@n0h0](https://github.com/n0h0).
4
+ * [#553](https://github.com/slack-ruby/slack-ruby-client/pull/553): Use `secure_compare` during signature verification - [@hieuk09](https://github.com/hieuk09).
5
+ * [#555](https://github.com/slack-ruby/slack-ruby-client/pull/555): Make page size in resolving IDs configurable - [@eizengan](https://github.com/eizengan).
6
+ * [#547](https://github.com/slack-ruby/slack-ruby-client/pull/547): Update API from [slack-api-ref@1ee282e](https://github.com/slack-ruby/slack-api-ref/commit/1ee282e) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot).
7
+
8
+ ### 2.5.2 (2025/02/19)
9
+
10
+ * [#548](https://github.com/slack-ruby/slack-ruby-client/pull/548): Fix: `files_upload_v2` with `#channel` - [@dblock](https://github.com/dblock).
11
+
1
12
  ### 2.5.1 (2025/02/11)
2
13
 
3
14
  * [#542](https://github.com/slack-ruby/slack-ruby-client/pull/542): Add support for ruby 3.4 - [@dblock](https://github.com/dblock).
data/Gemfile CHANGED
@@ -14,9 +14,12 @@ end
14
14
 
15
15
  group :test do
16
16
  gem 'activesupport'
17
+ gem 'base64'
18
+ gem 'bigdecimal'
17
19
  gem 'erubis'
18
20
  gem 'faraday-typhoeus'
19
21
  gem 'json-schema'
22
+ gem 'mutex_m'
20
23
  gem 'racc'
21
24
  gem 'rake', '~> 13'
22
25
  gem 'rspec'
data/README.md CHANGED
@@ -57,6 +57,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
57
57
  - [Date and Time Formatting](#date-and-time-formatting)
58
58
  - [Channel ID Formatting](#channel-id-formatting)
59
59
  - [User ID Formatting](#user-id-formatting)
60
+ - [Group ID Formatting](#group-id-formatting)
60
61
  - [URL Formatting](#url-formatting)
61
62
  - [Markdown Formatting](#markdown-formatting)
62
63
  - [Parsing Messages](#parsing-messages)
@@ -81,7 +82,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
81
82
 
82
83
  ## Stable Release
83
84
 
84
- You're reading the documentation for the **stable** release of slack-ruby-client, v2.5.1. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
85
+ You're reading the documentation for the **stable** release of slack-ruby-client. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
85
86
 
86
87
  ## Installation
87
88
 
@@ -177,8 +178,8 @@ This library provides a helper method `files_upload_v2` that wraps the three sep
177
178
  client.files_upload_v2(
178
179
  # required options
179
180
  filename: 'results.pdf', # this is used for the file title, unless a :title option is provided
180
- contents: File.read('/users/me/results.pdf'), # the string contents of the file
181
-
181
+ content: File.read('/users/me/results.pdf'), # the string contents of the file
182
+
182
183
  # optional options
183
184
  channels: ['C000000', 'C000001'], # channel IDs to share the file in (:channel_id, :channel, or :channels are all supported)
184
185
  initial_comment: 'Sharing the Q1 results :tada:', # the message that is included with the file share thread
@@ -280,20 +281,22 @@ client = Slack::Web::Client.new(user_agent: 'Slack Ruby Client/1.0')
280
281
 
281
282
  The following settings are supported.
282
283
 
283
- setting | description
284
- --------------------|-------------------------------------------------------------------------------------------------
285
- token | Slack API token.
286
- user_agent | User-agent, defaults to _Slack Ruby Client/version_.
287
- proxy | Optional HTTP proxy.
288
- ca_path | Optional SSL certificates path.
289
- ca_file | Optional SSL certificates file.
290
- endpoint | Slack endpoint, default is _https://slack.com/api_.
291
- logger | Optional `Logger` instance that logs HTTP requests.
292
- timeout | Optional open/read timeout in seconds.
293
- open_timeout | Optional connection open timeout in seconds.
294
- default_page_size | Optional page size for paginated requests, default is _100_.
295
- default_max_retries | Optional number of retries for paginated requests, default is _100_.
296
- adapter | Optional HTTP adapter to use, defaults to `Faraday.default_adapter`.
284
+ setting | description
285
+ -----------------------------|-------------------------------------------------------------------------------------------------
286
+ token | Slack API token.
287
+ user_agent | User-agent, defaults to _Slack Ruby Client/version_.
288
+ proxy | Optional HTTP proxy.
289
+ ca_path | Optional SSL certificates path.
290
+ ca_file | Optional SSL certificates file.
291
+ endpoint | Slack endpoint, default is _https://slack.com/api_.
292
+ logger | Optional `Logger` instance that logs HTTP requests.
293
+ timeout | Optional open/read timeout in seconds.
294
+ open_timeout | Optional connection open timeout in seconds.
295
+ default_page_size | Optional page size for paginated requests, default is _100_.
296
+ conversations_id_page_size | Optional page size for conversations_list requests made when calculating conversation id from a conversation name, default is _nil_, which will use the default_page_size.
297
+ users_id_page_size | Optional page size for users_list requests made when calculating user id from a user name, default is _nil_, which will use the default_page_size.
298
+ default_max_retries | Optional number of retries for paginated requests, default is _100_.
299
+ adapter | Optional HTTP adapter to use, defaults to `Faraday.default_adapter`.
297
300
 
298
301
  You can also pass request options, including `timeout` and `open_timeout` into individual calls.
299
302
 
@@ -665,6 +668,16 @@ Slack::Messages::Formatting.user_link(user_id)
665
668
  # => "<@U0000000001>"
666
669
  ```
667
670
 
671
+ ##### Group ID Formatting
672
+
673
+ If you already know the group name you can just embed it in the message as `@some_group`, but if you only have the ID you can embed it using special syntax which Slack will display as the group name.
674
+
675
+ ```ruby
676
+ group_id = 'S0000000001'
677
+ Slack::Messages::Formatting.group_link(group_id)
678
+ # => "<!subteam^S0000000001>"
679
+ ```
680
+
668
681
  ##### URL Formatting
669
682
 
670
683
  Slack will automatically parse fully qualified URLs in messages, but you need special formatting to embed a link with different text.
@@ -75,6 +75,17 @@ module Slack
75
75
  end
76
76
  end
77
77
 
78
+ g.desc 'Create a Salesforce channel for the corresponding object provided.'
79
+ g.long_desc %( Create a Salesforce channel for the corresponding object provided. )
80
+ g.command 'createForObjects' do |c|
81
+ c.flag 'object_id', desc: 'Object / Record ID (15 or 18 digit accepted). See here for how to look up an ID.'
82
+ c.flag 'salesforce_org_id', desc: 'Salesforce org ID (15 or 18 digit accepted). See here for how to look up Salesforce org ID.'
83
+ c.flag 'invite_object_team', desc: 'Optional flag to add all team members related to the object to the newly created Salesforce channel. When true, adds a maximum of 100 team members to the channel.'
84
+ c.action do |_global_options, options, _args|
85
+ puts JSON.dump(@client.admin_conversations_createForObjects(options))
86
+ end
87
+ end
88
+
78
89
  g.desc 'Delete a public or private channel.'
79
90
  g.long_desc %( Delete a public or private channel. )
80
91
  g.command 'delete' do |c|
@@ -219,7 +230,7 @@ module Slack
219
230
  c.flag 'channel_id', desc: 'The encoded channel_id to add or remove to workspaces.'
220
231
  c.flag 'org_channel', desc: 'True if channel has to be converted to an org channel.'
221
232
  c.flag 'target_team_ids', desc: 'A comma-separated list of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide.'
222
- c.flag 'team_id', desc: 'The workspace to which the channel belongs. Omit this argument if the channel is a cross-workspace shared channel.'
233
+ c.flag 'team_id', desc: 'The workspace to which the channel belongs if the channel is a local workspace channel. Omit this argument if the channel is a cross-workspace or org-wide shared channel.'
223
234
  c.action do |_global_options, options, _args|
224
235
  puts JSON.dump(@client.admin_conversations_setTeams(options))
225
236
  end
@@ -44,7 +44,7 @@ module Slack
44
44
  c.flag 'include_deactivated_user_workspaces', desc: 'Only applies with org token and no team_id. If true, return workspaces for a user even if they may be deactivated on them. If false, return workspaces for a user only when user is active on them. Default is false.'
45
45
  c.flag 'is_active', desc: 'If true, only active users will be returned. If false, only deactivated users will be returned. Default is true.'
46
46
  c.flag 'limit', desc: 'Limit for how many users to be retrieved per page.'
47
- c.flag 'team_id', desc: 'The ID (T1234) of the workspace. The team_id is required if you use an org-level token.'
47
+ c.flag 'team_id', desc: 'The ID (T1234) of a workspace. Filters results to just the specified workspace.'
48
48
  c.action do |_global_options, options, _args|
49
49
  puts JSON.dump(@client.admin_users_list(options))
50
50
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'AssistantSearch methods.'
8
+ command 'assistant_search' do |g|
9
+ g.desc 'Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval.'
10
+ g.long_desc %( Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval. )
11
+ g.command 'context' do |c|
12
+ c.flag 'query', desc: 'User prompt or search query.'
13
+ c.flag 'action_token', desc: 'Send action_token as received in a message event.'
14
+ c.flag 'channel_types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.'
15
+ c.flag 'content_types', desc: 'Content types to include, a comma-separated list of any combination of messages, files.'
16
+ c.flag 'context_channel_id', desc: 'Context channel ID to support scoping the search when applicable.'
17
+ c.flag 'cursor', desc: 'The cursor returned by the API. Leave this blank for the first request, and use this to get the next page of results.'
18
+ c.flag 'include_bots', desc: 'If you want the results to include bots.'
19
+ c.flag 'limit', desc: 'Number of results to return, up to a max of 20. Defaults to 20.'
20
+ c.action do |_global_options, options, _args|
21
+ puts JSON.dump(@client.assistant_search_context(options))
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -9,6 +9,7 @@ module Slack
9
9
  g.desc 'Create canvas for a user'
10
10
  g.long_desc %( Create canvas for a user )
11
11
  g.command 'create' do |c|
12
+ c.flag 'channel_id', desc: 'Channel ID of the channel the canvas will be tabbed in. This is a required field for free teams.'
12
13
  c.flag 'document_content', desc: 'Structure describing the type and value of the content to create.'
13
14
  c.flag 'title', desc: 'Title of the newly created canvas.'
14
15
  c.action do |_global_options, options, _args|
data/bin/commands/chat.rb CHANGED
@@ -87,6 +87,7 @@ module Slack
87
87
  c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
88
88
  c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.'
89
89
  c.flag 'text', desc: 'How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.'
90
+ c.flag 'agent_message_source_type', desc: 'Identify how the message was posted for agentforce BE logging.'
90
91
  c.flag 'as_user', desc: '(Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic apps. See legacy as_user parameter below.'
91
92
  c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url.'
92
93
  c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message.'
@@ -11,6 +11,7 @@ module Slack
11
11
  g.command 'create' do |c|
12
12
  c.flag 'channel_id', desc: 'Channel ID of the channel we create the channel canvas for.'
13
13
  c.flag 'document_content', desc: 'Structure describing the type and value of the content to create.'
14
+ c.flag 'title', desc: 'Title of the newly created canvas.'
14
15
  c.action do |_global_options, options, _args|
15
16
  puts JSON.dump(@client.conversations_canvases_create(options))
16
17
  end
@@ -10,6 +10,7 @@ module Slack
10
10
  g.long_desc %( Finishes an upload started with files.getUploadURLExternal )
11
11
  g.command 'completeUploadExternal' do |c|
12
12
  c.flag 'files', desc: 'Array of file ids and their corresponding (optional) titles.'
13
+ c.flag 'blocks', desc: 'A JSON-based array of structured rich text blocks, presented as a URL-encoded string. If the initial_comment field is provided, the blocks field is ignored.'
13
14
  c.flag 'channel_id', desc: 'Channel ID where the file will be shared. If not specified the file will be private.'
14
15
  c.flag 'channels', desc: 'Comma-separated string of channel IDs where the file will be shared.'
15
16
  c.flag 'initial_comment', desc: 'The message text introducing the file in specified channels.'
@@ -18,8 +18,8 @@ module Slack
18
18
  end
19
19
  end
20
20
 
21
- g.desc 'List the access type of a custom slack function and include the users with access if its permission_type is set to named_entities'
22
- g.long_desc %( List the access type of a custom slack function and include the users with access if its permission_type is set to named_entities )
21
+ g.desc 'List the access type of a custom slack function and include the users or team or org ids with access if its permission_type is set to named_entities'
22
+ g.long_desc %( List the access type of a custom slack function and include the users or team or org ids with access if its permission_type is set to named_entities )
23
23
  g.command 'list' do |c|
24
24
  c.flag 'function_app_id', desc: 'The encoded ID of the app.'
25
25
  c.flag 'function_callback_id', desc: "The callback ID defined in the function's definition file."
@@ -41,13 +41,15 @@ module Slack
41
41
  end
42
42
  end
43
43
 
44
- g.desc 'Set the access type of a custom slack function and define the users to be granted access if permission_type is set to named_entities'
45
- g.long_desc %( Set the access type of a custom slack function and define the users to be granted access if permission_type is set to named_entities )
44
+ g.desc 'Set the access type of a custom slack function and define the users or team or org ids to be granted access if permission_type is set to named_entities'
45
+ g.long_desc %( Set the access type of a custom slack function and define the users or team or org ids to be granted access if permission_type is set to named_entities )
46
46
  g.command 'set' do |c|
47
47
  c.flag 'permission_type', desc: 'The type of permission that defines how the function can be distributed.'
48
48
  c.flag 'function_app_id', desc: 'The encoded ID of the app.'
49
49
  c.flag 'function_callback_id', desc: "The callback ID defined in the function's definition file."
50
50
  c.flag 'function_id', desc: 'The encoded ID of the function.'
51
+ c.flag 'org_ids', desc: 'List of org IDs to allow for named_entities permission.'
52
+ c.flag 'team_ids', desc: 'List of team IDs to allow for named_entities permission.'
51
53
  c.flag 'user_ids', desc: 'List of encoded user IDs.'
52
54
  c.action do |_global_options, options, _args|
53
55
  puts JSON.dump(@client.functions_distributions_permissions_set(options))
@@ -51,7 +51,6 @@ module Slack
51
51
  c.flag 'include_disabled', desc: 'Include disabled User Groups.'
52
52
  c.flag 'include_users', desc: 'Include the list of users for each User Group.'
53
53
  c.flag 'team_id', desc: 'encoded team id to list user groups in, required if org token is used.'
54
- c.flag 'usergroup_id', desc: 'The id of the usergroup you would like to filter the results down to.'
55
54
  c.action do |_global_options, options, _args|
56
55
  puts JSON.dump(@client.usergroups_list(options))
57
56
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Slack
3
4
  module Events
4
5
  class Request
@@ -59,7 +60,7 @@ module Slack
59
60
  signature_basestring = [version, timestamp, body].join(':')
60
61
  hex_hash = OpenSSL::HMAC.hexdigest(digest, signing_secret, signature_basestring)
61
62
  computed_signature = [version, hex_hash].join('=')
62
- computed_signature == signature
63
+ Utils::Security.secure_compare(computed_signature, signature)
63
64
  end
64
65
 
65
66
  # Validates the request signature and its expiration.
@@ -61,6 +61,14 @@ module Slack
61
61
  "<@#{user_id}>"
62
62
  end
63
63
 
64
+ #
65
+ # Embed a link to a group in a message by group ID
66
+ # @see https://api.slack.com/reference/surfaces/formatting#mentioning-groups
67
+ #
68
+ def group_link(group_id)
69
+ "<!subteam^#{group_id}>"
70
+ end
71
+
64
72
  #
65
73
  # Embed a URL with custom link text in a message
66
74
  # @see https://api.slack.com/reference/surfaces/formatting#linking-urls
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This module is copied from activesupport
4
+ # https://github.com/rails/rails/blob/3235827585d87661942c91bc81f64f56d710f0b2/activesupport/lib/active_support/security_utils.rb
5
+ module Slack
6
+ module Utils
7
+ # rubocop:disable Naming/MethodParameterName
8
+ module Security
9
+ # Constant time string comparison, for fixed length strings.
10
+ #
11
+ # The values compared should be of fixed length, such as strings
12
+ # that have already been processed by HMAC. Raises in case of length mismatch.
13
+
14
+ if defined?(OpenSSL.fixed_length_secure_compare)
15
+ def fixed_length_secure_compare(a, b)
16
+ OpenSSL.fixed_length_secure_compare(a, b)
17
+ end
18
+ else
19
+ def fixed_length_secure_compare(a, b)
20
+ raise ArgumentError, 'inputs must be of equal length' unless a.bytesize == b.bytesize
21
+
22
+ l = a.unpack "C#{a.bytesize}"
23
+
24
+ res = 0
25
+ b.each_byte { |byte| res |= byte ^ l.shift }
26
+ res.zero?
27
+ end
28
+ end
29
+ module_function :fixed_length_secure_compare
30
+
31
+ # Secure string comparison for strings of variable length.
32
+ #
33
+ # While a timing attack would not be able to discern the content of
34
+ # a secret compared via secure_compare, it is possible to determine
35
+ # the secret length. This should be considered when using secure_compare
36
+ # to compare weak, short secrets to user input.
37
+ def secure_compare(a, b)
38
+ a.bytesize == b.bytesize && fixed_length_secure_compare(a, b)
39
+ end
40
+ module_function :secure_compare
41
+ end
42
+ # rubocop:enable Naming/MethodParameterName
43
+ end
44
+ end
data/lib/slack/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Slack
3
- VERSION = '2.5.1'
3
+ VERSION = '2.6.0'
4
4
  end
@@ -104,6 +104,23 @@ module Slack
104
104
  post('admin.conversations.create', options)
105
105
  end
106
106
 
107
+ #
108
+ # Create a Salesforce channel for the corresponding object provided.
109
+ #
110
+ # @option options [string] :object_id
111
+ # Object / Record ID (15 or 18 digit accepted). See here for how to look up an ID.
112
+ # @option options [string] :salesforce_org_id
113
+ # Salesforce org ID (15 or 18 digit accepted). See here for how to look up Salesforce org ID.
114
+ # @option options [boolean] :invite_object_team
115
+ # Optional flag to add all team members related to the object to the newly created Salesforce channel. When true, adds a maximum of 100 team members to the channel.
116
+ # @see https://api.slack.com/methods/admin.conversations.createForObjects
117
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.createForObjects.json
118
+ def admin_conversations_createForObjects(options = {})
119
+ raise ArgumentError, 'Required arguments :object_id missing' if options[:object_id].nil?
120
+ raise ArgumentError, 'Required arguments :salesforce_org_id missing' if options[:salesforce_org_id].nil?
121
+ post('admin.conversations.createForObjects', options)
122
+ end
123
+
107
124
  #
108
125
  # Delete a public or private channel.
109
126
  #
@@ -338,7 +355,7 @@ module Slack
338
355
  # @option options [array] :target_team_ids
339
356
  # A comma-separated list of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide.
340
357
  # @option options [Object] :team_id
341
- # The workspace to which the channel belongs. Omit this argument if the channel is a cross-workspace shared channel.
358
+ # The workspace to which the channel belongs if the channel is a local workspace channel. Omit this argument if the channel is a cross-workspace or org-wide shared channel.
342
359
  # @see https://api.slack.com/methods/admin.conversations.setTeams
343
360
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.setTeams.json
344
361
  def admin_conversations_setTeams(options = {})
@@ -71,7 +71,7 @@ module Slack
71
71
  # @option options [integer] :limit
72
72
  # Limit for how many users to be retrieved per page.
73
73
  # @option options [Object] :team_id
74
- # The ID (T1234) of the workspace. The team_id is required if you use an org-level token.
74
+ # The ID (T1234) of a workspace. Filters results to just the specified workspace.
75
75
  # @see https://api.slack.com/methods/admin.users.list
76
76
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.list.json
77
77
  def admin_users_list(options = {})
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module AssistantSearch
9
+ #
10
+ # Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval.
11
+ #
12
+ # @option options [string] :query
13
+ # User prompt or search query.
14
+ # @option options [string] :action_token
15
+ # Send action_token as received in a message event.
16
+ # @option options [array] :channel_types
17
+ # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
18
+ # @option options [array] :content_types
19
+ # Content types to include, a comma-separated list of any combination of messages, files.
20
+ # @option options [Object] :context_channel_id
21
+ # Context channel ID to support scoping the search when applicable.
22
+ # @option options [string] :cursor
23
+ # The cursor returned by the API. Leave this blank for the first request, and use this to get the next page of results.
24
+ # @option options [boolean] :include_bots
25
+ # If you want the results to include bots.
26
+ # @option options [integer] :limit
27
+ # Number of results to return, up to a max of 20. Defaults to 20.
28
+ # @see https://api.slack.com/methods/assistant.search.context
29
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/assistant.search/assistant.search.context.json
30
+ def assistant_search_context(options = {})
31
+ raise ArgumentError, 'Required arguments :query missing' if options[:query].nil?
32
+ if block_given?
33
+ Pagination::Cursor.new(self, :assistant_search_context, options).each do |page|
34
+ yield page
35
+ end
36
+ else
37
+ post('assistant.search.context', options)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -9,6 +9,8 @@ module Slack
9
9
  #
10
10
  # Create canvas for a user
11
11
  #
12
+ # @option options [string] :channel_id
13
+ # Channel ID of the channel the canvas will be tabbed in. This is a required field for free teams.
12
14
  # @option options [Object] :document_content
13
15
  # Structure describing the type and value of the content to create.
14
16
  # @option options [string] :title
@@ -142,6 +142,8 @@ module Slack
142
142
  # A JSON-based array of structured blocks, presented as a URL-encoded string.
143
143
  # @option options [string] :text
144
144
  # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
145
+ # @option options [Object] :agent_message_source_type
146
+ # Identify how the message was posted for agentforce BE logging.
145
147
  # @option options [boolean] :as_user
146
148
  # (Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic apps. See legacy as_user parameter below.
147
149
  # @option options [string] :icon_emoji
@@ -207,7 +207,6 @@ module Slack
207
207
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.kick.json
208
208
  def conversations_kick(options = {})
209
209
  raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
210
- raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?
211
210
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
212
211
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
213
212
  post('conversations.kick', options)
@@ -13,6 +13,8 @@ module Slack
13
13
  # Channel ID of the channel we create the channel canvas for.
14
14
  # @option options [Object] :document_content
15
15
  # Structure describing the type and value of the content to create.
16
+ # @option options [string] :title
17
+ # Title of the newly created canvas.
16
18
  # @see https://api.slack.com/methods/conversations.canvases.create
17
19
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations.canvases/conversations.canvases.create.json
18
20
  def conversations_canvases_create(options = {})
@@ -11,6 +11,8 @@ module Slack
11
11
  #
12
12
  # @option options [array] :files
13
13
  # Array of file ids and their corresponding (optional) titles.
14
+ # @option options [blocks[] as string] :blocks
15
+ # A JSON-based array of structured rich text blocks, presented as a URL-encoded string. If the initial_comment field is provided, the blocks field is ignored.
14
16
  # @option options [Object] :channel_id
15
17
  # Channel ID where the file will be shared. If not specified the file will be private.
16
18
  # @option options [string] :channels
@@ -23,6 +25,7 @@ module Slack
23
25
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.completeUploadExternal.json
24
26
  def files_completeUploadExternal(options = {})
25
27
  raise ArgumentError, 'Required arguments :files missing' if options[:files].nil?
28
+ options = encode_options_as_json(options, %i[blocks])
26
29
  post('files.completeUploadExternal', options)
27
30
  end
28
31
 
@@ -24,7 +24,7 @@ module Slack
24
24
  end
25
25
 
26
26
  #
27
- # List the access type of a custom slack function and include the users with access if its permission_type is set to named_entities
27
+ # List the access type of a custom slack function and include the users or team or org ids with access if its permission_type is set to named_entities
28
28
  #
29
29
  # @option options [string] :function_app_id
30
30
  # The encoded ID of the app.
@@ -56,7 +56,7 @@ module Slack
56
56
  end
57
57
 
58
58
  #
59
- # Set the access type of a custom slack function and define the users to be granted access if permission_type is set to named_entities
59
+ # Set the access type of a custom slack function and define the users or team or org ids to be granted access if permission_type is set to named_entities
60
60
  #
61
61
  # @option options [enum] :permission_type
62
62
  # The type of permission that defines how the function can be distributed.
@@ -66,6 +66,10 @@ module Slack
66
66
  # The callback ID defined in the function's definition file.
67
67
  # @option options [string] :function_id
68
68
  # The encoded ID of the function.
69
+ # @option options [array] :org_ids
70
+ # List of org IDs to allow for named_entities permission.
71
+ # @option options [array] :team_ids
72
+ # List of team IDs to allow for named_entities permission.
69
73
  # @option options [array] :user_ids
70
74
  # List of encoded user IDs.
71
75
  # @see https://api.slack.com/methods/functions.distributions.permissions.set
@@ -75,8 +75,6 @@ module Slack
75
75
  # Include the list of users for each User Group.
76
76
  # @option options [string] :team_id
77
77
  # encoded team id to list user groups in, required if org token is used.
78
- # @option options [Object] :usergroup_id
79
- # The id of the usergroup you would like to filter the results down to.
80
78
  # @see https://api.slack.com/methods/usergroups.list
81
79
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.list.json
82
80
  def usergroups_list(options = {})
@@ -41,6 +41,7 @@ require_relative 'endpoints/apps_connections'
41
41
  require_relative 'endpoints/apps_datastore'
42
42
  require_relative 'endpoints/apps_event_authorizations'
43
43
  require_relative 'endpoints/apps_manifest'
44
+ require_relative 'endpoints/assistant_search'
44
45
  require_relative 'endpoints/assistant_threads'
45
46
  require_relative 'endpoints/auth'
46
47
  require_relative 'endpoints/auth_teams'
@@ -141,6 +142,7 @@ module Slack
141
142
  include AppsDatastore
142
143
  include AppsEventAuthorizations
143
144
  include AppsManifest
145
+ include AssistantSearch
144
146
  include AssistantThreads
145
147
  include Auth
146
148
  include AuthTeams
@@ -112,6 +112,7 @@ module Slack
112
112
  class CanvasGloballyDisabled < SlackError; end
113
113
  class CanvasNotFound < SlackError; end
114
114
  class CanvasTabCreationFailed < SlackError; end
115
+ class ChannelAlreadyExists < SlackError; end
115
116
  class ChannelArchived < SlackError; end
116
117
  class ChannelCannotBeUnshared < SlackError; end
117
118
  class ChannelCanvasAlreadyExists < SlackError; end
@@ -137,6 +138,7 @@ module Slack
137
138
  class ConnectedUserDenied < SlackError; end
138
139
  class ConnectionLimitExceeded < SlackError; end
139
140
  class ConnectionLimitExceededPending < SlackError; end
141
+ class ContextChannelNotFound < SlackError; end
140
142
  class CouldNotArchiveChannel < SlackError; end
141
143
  class CouldNotConvertChannel < SlackError; end
142
144
  class CouldNotCreateChannel < SlackError; end
@@ -242,6 +244,7 @@ module Slack
242
244
  class FeatureNotAvailable < SlackError; end
243
245
  class FeatureNotEnabled < SlackError; end
244
246
  class FetchMembersFailed < SlackError; end
247
+ class FileAlreadyAdded < SlackError; end
245
248
  class FileCommentNotFound < SlackError; end
246
249
  class FileDeleted < SlackError; end
247
250
  class FileDeletingDisabled < SlackError; end
@@ -256,7 +259,7 @@ module Slack
256
259
  class ForbiddenTeam < SlackError; end
257
260
  class FreeTeamCanvasTabAlreadyExists < SlackError; end
258
261
  class FreeTeamNotAllowed < SlackError; end
259
- class FreeTeamsCannotCreateStandaloneCanvases < SlackError; end
262
+ class FreeTeamsCannotCreateNonTabbedCanvases < SlackError; end
260
263
  class FreeTeamsCannotEditStandaloneCanvases < SlackError; end
261
264
  class FunctionExecutionNotFound < SlackError; end
262
265
  class FunctionNotFound < SlackError; end
@@ -272,6 +275,7 @@ module Slack
272
275
  class InsecureRequest < SlackError; end
273
276
  class InternalError < SlackError; end
274
277
  class InvalidAction < SlackError; end
278
+ class InvalidActionToken < SlackError; end
275
279
  class InvalidActor < SlackError; end
276
280
  class InvalidApp < SlackError; end
277
281
  class InvalidAppActionType < SlackError; end
@@ -326,6 +330,8 @@ module Slack
326
330
  class InvalidNameRequired < SlackError; end
327
331
  class InvalidNameSpecials < SlackError; end
328
332
  class InvalidNamedEntities < SlackError; end
333
+ class InvalidOooMessage < SlackError; end
334
+ class InvalidOrgId < SlackError; end
329
335
  class InvalidOutputs < SlackError; end
330
336
  class InvalidParameters < SlackError; end
331
337
  class InvalidParentType < SlackError; end
@@ -352,6 +358,7 @@ module Slack
352
358
  class InvalidSortDir < SlackError; end
353
359
  class InvalidSource < SlackError; end
354
360
  class InvalidStartTime < SlackError; end
361
+ class InvalidStartsWithAt < SlackError; end
355
362
  class InvalidStepStatus < SlackError; end
356
363
  class InvalidTargetTeam < SlackError; end
357
364
  class InvalidTeam < SlackError; end
@@ -402,6 +409,7 @@ module Slack
402
409
  class LegacyConnectionLimitExceeded < SlackError; end
403
410
  class LimitRequired < SlackError; end
404
411
  class LinkNotFound < SlackError; end
412
+ class ListRecordCommentFetchFailed < SlackError; end
405
413
  class MalwareDetected < SlackError; end
406
414
  class ManagedChannelNotSupported < SlackError; end
407
415
  class MarkdownTextConflict < SlackError; end
@@ -427,6 +435,8 @@ module Slack
427
435
  class MissingFileData < SlackError; end
428
436
  class MissingPostType < SlackError; end
429
437
  class MissingProfileId < SlackError; end
438
+ class MissingQuery < SlackError; end
439
+ class MissingRecordChannelConfig < SlackError; end
430
440
  class MissingResource < SlackError; end
431
441
  class MissingScope < SlackError; end
432
442
  class MissingSource < SlackError; end
@@ -451,6 +461,7 @@ module Slack
451
461
  class NameTakenInOrg < SlackError; end
452
462
  class NameTooLong < SlackError; end
453
463
  class NamedEntitiesCannotBeEmpty < SlackError; end
464
+ class NoAccess < SlackError; end
454
465
  class NoActiveSessions < SlackError; end
455
466
  class NoAliasSelected < SlackError; end
456
467
  class NoBotUserForApp < SlackError; end
@@ -502,6 +513,7 @@ module Slack
502
513
  class NotInTeam < SlackError; end
503
514
  class NotOwner < SlackError; end
504
515
  class NotPaid < SlackError; end
516
+ class NotPermitted < SlackError; end
505
517
  class NotPinnable < SlackError; end
506
518
  class NotPinned < SlackError; end
507
519
  class NotReactable < SlackError; end
@@ -536,9 +548,11 @@ module Slack
536
548
  class PrimaryUsergroupNotFound < SlackError; end
537
549
  class ProfileSetFailed < SlackError; end
538
550
  class ProvidersNotFound < SlackError; end
551
+ class PublicFileTypeNotAllowed < SlackError; end
539
552
  class PublicVideoNotAllowed < SlackError; end
540
553
  class PublishedAppOnly < SlackError; end
541
554
  class PushLimitReached < SlackError; end
555
+ class QueryTooLong < SlackError; end
542
556
  class RateLimited < SlackError; end
543
557
  class Ratelimit < SlackError; end
544
558
  class Ratelimited < SlackError; end
@@ -618,6 +632,7 @@ module Slack
618
632
  class TooManyNamedEntities < SlackError; end
619
633
  class TooManyPins < SlackError; end
620
634
  class TooManyReactions < SlackError; end
635
+ class TooManyTabs < SlackError; end
621
636
  class TooManyTargetTeams < SlackError; end
622
637
  class TooManyTeams < SlackError; end
623
638
  class TooManyTeamsProvided < SlackError; end
@@ -674,6 +689,7 @@ module Slack
674
689
  class UsergroupNotFound < SlackError; end
675
690
  class UsergroupNotLinkedToTeam < SlackError; end
676
691
  class UsergroupTeamNotProvisioned < SlackError; end
692
+ class UsernameSame < SlackError; end
677
693
  class UsersListNotSupplied < SlackError; end
678
694
  class UsersNotFound < SlackError; end
679
695
  class ValidationErrors < SlackError; end
@@ -789,6 +805,7 @@ module Slack
789
805
  'canvas_globally_disabled' => CanvasGloballyDisabled,
790
806
  'canvas_not_found' => CanvasNotFound,
791
807
  'canvas_tab_creation_failed' => CanvasTabCreationFailed,
808
+ 'channel_already_exists' => ChannelAlreadyExists,
792
809
  'channel_archived' => ChannelArchived,
793
810
  'channel_cannot_be_unshared' => ChannelCannotBeUnshared,
794
811
  'channel_canvas_already_exists' => ChannelCanvasAlreadyExists,
@@ -814,6 +831,7 @@ module Slack
814
831
  'connected_user_denied' => ConnectedUserDenied,
815
832
  'connection_limit_exceeded' => ConnectionLimitExceeded,
816
833
  'connection_limit_exceeded_pending' => ConnectionLimitExceededPending,
834
+ 'context_channel_not_found' => ContextChannelNotFound,
817
835
  'could_not_archive_channel' => CouldNotArchiveChannel,
818
836
  'could_not_convert_channel' => CouldNotConvertChannel,
819
837
  'could_not_create_channel' => CouldNotCreateChannel,
@@ -919,6 +937,7 @@ module Slack
919
937
  'feature_not_available' => FeatureNotAvailable,
920
938
  'feature_not_enabled' => FeatureNotEnabled,
921
939
  'fetch_members_failed' => FetchMembersFailed,
940
+ 'file_already_added' => FileAlreadyAdded,
922
941
  'file_comment_not_found' => FileCommentNotFound,
923
942
  'file_deleted' => FileDeleted,
924
943
  'file_deleting_disabled' => FileDeletingDisabled,
@@ -933,7 +952,7 @@ module Slack
933
952
  'forbidden_team' => ForbiddenTeam,
934
953
  'free_team_canvas_tab_already_exists' => FreeTeamCanvasTabAlreadyExists,
935
954
  'free_team_not_allowed' => FreeTeamNotAllowed,
936
- 'free_teams_cannot_create_standalone_canvases' => FreeTeamsCannotCreateStandaloneCanvases,
955
+ 'free_teams_cannot_create_non_tabbed_canvases' => FreeTeamsCannotCreateNonTabbedCanvases,
937
956
  'free_teams_cannot_edit_standalone_canvases' => FreeTeamsCannotEditStandaloneCanvases,
938
957
  'function_execution_not_found' => FunctionExecutionNotFound,
939
958
  'function_not_found' => FunctionNotFound,
@@ -949,6 +968,7 @@ module Slack
949
968
  'insecure_request' => InsecureRequest,
950
969
  'internal_error' => InternalError,
951
970
  'invalid_action' => InvalidAction,
971
+ 'invalid_action_token' => InvalidActionToken,
952
972
  'invalid_actor' => InvalidActor,
953
973
  'invalid_app' => InvalidApp,
954
974
  'invalid_app_action_type' => InvalidAppActionType,
@@ -1003,6 +1023,8 @@ module Slack
1003
1023
  'invalid_name_required' => InvalidNameRequired,
1004
1024
  'invalid_name_specials' => InvalidNameSpecials,
1005
1025
  'invalid_named_entities' => InvalidNamedEntities,
1026
+ 'invalid_ooo_message' => InvalidOooMessage,
1027
+ 'invalid_org_id' => InvalidOrgId,
1006
1028
  'invalid_outputs' => InvalidOutputs,
1007
1029
  'invalid_parameters' => InvalidParameters,
1008
1030
  'invalid_parent_type' => InvalidParentType,
@@ -1029,6 +1051,7 @@ module Slack
1029
1051
  'invalid_sort_dir' => InvalidSortDir,
1030
1052
  'invalid_source' => InvalidSource,
1031
1053
  'invalid_start_time' => InvalidStartTime,
1054
+ 'invalid_starts_with_at' => InvalidStartsWithAt,
1032
1055
  'invalid_step_status' => InvalidStepStatus,
1033
1056
  'invalid_target_team' => InvalidTargetTeam,
1034
1057
  'invalid_team' => InvalidTeam,
@@ -1079,6 +1102,7 @@ module Slack
1079
1102
  'legacy_connection_limit_exceeded' => LegacyConnectionLimitExceeded,
1080
1103
  'limit_required' => LimitRequired,
1081
1104
  'link_not_found' => LinkNotFound,
1105
+ 'list_record_comment_fetch_failed' => ListRecordCommentFetchFailed,
1082
1106
  'malware_detected' => MalwareDetected,
1083
1107
  'managed_channel_not_supported' => ManagedChannelNotSupported,
1084
1108
  'markdown_text_conflict' => MarkdownTextConflict,
@@ -1104,6 +1128,8 @@ module Slack
1104
1128
  'missing_file_data' => MissingFileData,
1105
1129
  'missing_post_type' => MissingPostType,
1106
1130
  'missing_profile_id' => MissingProfileId,
1131
+ 'missing_query' => MissingQuery,
1132
+ 'missing_record_channel_config' => MissingRecordChannelConfig,
1107
1133
  'missing_resource' => MissingResource,
1108
1134
  'missing_scope' => MissingScope,
1109
1135
  'missing_source' => MissingSource,
@@ -1128,6 +1154,7 @@ module Slack
1128
1154
  'name_taken_in_org' => NameTakenInOrg,
1129
1155
  'name_too_long' => NameTooLong,
1130
1156
  'named_entities_cannot_be_empty' => NamedEntitiesCannotBeEmpty,
1157
+ 'no_access' => NoAccess,
1131
1158
  'no_active_sessions' => NoActiveSessions,
1132
1159
  'no_alias_selected' => NoAliasSelected,
1133
1160
  'no_bot_user_for_app' => NoBotUserForApp,
@@ -1179,6 +1206,7 @@ module Slack
1179
1206
  'not_in_team' => NotInTeam,
1180
1207
  'not_owner' => NotOwner,
1181
1208
  'not_paid' => NotPaid,
1209
+ 'not_permitted' => NotPermitted,
1182
1210
  'not_pinnable' => NotPinnable,
1183
1211
  'not_pinned' => NotPinned,
1184
1212
  'not_reactable' => NotReactable,
@@ -1213,9 +1241,11 @@ module Slack
1213
1241
  'primary_usergroup_not_found' => PrimaryUsergroupNotFound,
1214
1242
  'profile_set_failed' => ProfileSetFailed,
1215
1243
  'providers_not_found' => ProvidersNotFound,
1244
+ 'public_file_type_not_allowed' => PublicFileTypeNotAllowed,
1216
1245
  'public_video_not_allowed' => PublicVideoNotAllowed,
1217
1246
  'published_app_only' => PublishedAppOnly,
1218
1247
  'push_limit_reached' => PushLimitReached,
1248
+ 'query_too_long' => QueryTooLong,
1219
1249
  'rate_limited' => RateLimited,
1220
1250
  'ratelimit' => Ratelimit,
1221
1251
  'ratelimited' => Ratelimited,
@@ -1295,6 +1325,7 @@ module Slack
1295
1325
  'too_many_named_entities' => TooManyNamedEntities,
1296
1326
  'too_many_pins' => TooManyPins,
1297
1327
  'too_many_reactions' => TooManyReactions,
1328
+ 'too_many_tabs' => TooManyTabs,
1298
1329
  'too_many_target_teams' => TooManyTargetTeams,
1299
1330
  'too_many_teams' => TooManyTeams,
1300
1331
  'too_many_teams_provided' => TooManyTeamsProvided,
@@ -1351,6 +1382,7 @@ module Slack
1351
1382
  'usergroup_not_found' => UsergroupNotFound,
1352
1383
  'usergroup_not_linked_to_team' => UsergroupNotLinkedToTeam,
1353
1384
  'usergroup_team_not_provisioned' => UsergroupTeamNotProvisioned,
1385
+ 'username_same' => UsernameSame,
1354
1386
  'users_list_not_supplied' => UsersListNotSupplied,
1355
1387
  'users_not_found' => UsersNotFound,
1356
1388
  'validation_errors' => ValidationErrors,
@@ -46,7 +46,7 @@ module Slack
46
46
  conversations_id(channel: channel)['channel']['id']
47
47
  end.uniq.join(',')
48
48
  elsif params[:channel]
49
- complete_upload_request_params[:channel] = conversations_id(
49
+ complete_upload_request_params[:channel_id] = conversations_id(
50
50
  channel: params[:channel]
51
51
  )['channel']['id']
52
52
  elsif params[:channel_id]
@@ -12,11 +12,22 @@ module Slack
12
12
  #
13
13
  # @option options [channel] :channel
14
14
  # Channel to get ID for, prefixed with #.
15
+ # @option options [integer] :id_limit
16
+ # The page size used for conversations_list calls required to find the channel's ID
15
17
  def conversations_id(options = {})
16
18
  name = options[:channel]
19
+ limit = options.fetch(:id_limit, Slack::Web.config.conversations_id_page_size)
20
+
17
21
  raise ArgumentError, 'Required arguments :channel missing' if name.nil?
18
22
 
19
- id_for :channel, name, '#', :conversations_list, :channels, 'channel_not_found'
23
+ id_for(
24
+ key: :channel,
25
+ name: name,
26
+ prefix: '#',
27
+ enum_method: :conversations_list,
28
+ list_method: :channels,
29
+ options: { limit: limit }.compact
30
+ )
20
31
  end
21
32
  end
22
33
  end
@@ -6,16 +6,16 @@ module Slack
6
6
  module Ids
7
7
  private
8
8
 
9
- def id_for(key, name, prefix, enum_method, list_method, not_found_error)
9
+ def id_for(key:, name:, prefix:, enum_method:, list_method:, options: {})
10
10
  return { 'ok' => true, key.to_s => { 'id' => name } } unless name[0] == prefix
11
11
 
12
- public_send enum_method do |list|
12
+ public_send(enum_method, **options) do |list|
13
13
  list.public_send(list_method).each do |li|
14
14
  return Slack::Messages::Message.new('ok' => true, key.to_s => { 'id' => li.id }) if li.name == name[1..-1]
15
15
  end
16
16
  end
17
17
 
18
- raise Slack::Web::Api::Errors::SlackError, not_found_error
18
+ raise Slack::Web::Api::Errors::SlackError, "#{key}_not_found"
19
19
  end
20
20
  end
21
21
  end
@@ -12,11 +12,22 @@ module Slack
12
12
  #
13
13
  # @option options [user] :user
14
14
  # User to get ID for, prefixed with '@'.
15
+ # @option options [integer] :id_limit
16
+ # The page size used for users_list calls required to find the user's ID
15
17
  def users_id(options = {})
16
18
  name = options[:user]
19
+ limit = options.fetch(:id_limit, Slack::Web.config.users_id_page_size)
20
+
17
21
  raise ArgumentError, 'Required arguments :user missing' if name.nil?
18
22
 
19
- id_for :user, name, '@', :users_list, :members, 'user_not_found'
23
+ id_for(
24
+ key: :user,
25
+ name: name,
26
+ prefix: '@',
27
+ enum_method: :users_list,
28
+ list_method: :members,
29
+ options: { limit: limit }.compact
30
+ )
20
31
  end
21
32
  end
22
33
  end
@@ -15,6 +15,8 @@ module Slack
15
15
  timeout
16
16
  open_timeout
17
17
  default_page_size
18
+ conversations_id_page_size
19
+ users_id_page_size
18
20
  default_max_retries
19
21
  adapter
20
22
  ].freeze
@@ -32,6 +34,8 @@ module Slack
32
34
  self.timeout = nil
33
35
  self.open_timeout = nil
34
36
  self.default_page_size = 100
37
+ self.conversations_id_page_size = nil
38
+ self.users_id_page_size = nil
35
39
  self.default_max_retries = 100
36
40
  self.adapter = ::Faraday.default_adapter
37
41
  end
@@ -22,7 +22,7 @@ end
22
22
  begin
23
23
  require 'openssl'
24
24
  rescue LoadError # rubocop:disable Lint/SuppressedException
25
- # Used in slack/web/config
25
+ # Used in slack/web/config and slack/utils/security
26
26
  end
27
27
  require_relative 'slack/web/config'
28
28
  require_relative 'slack/web/api/errors/slack_error'
@@ -57,3 +57,5 @@ require_relative 'slack/real_time/client'
57
57
  # Events API
58
58
  require_relative 'slack/events/config'
59
59
  require_relative 'slack/events/request'
60
+
61
+ require_relative 'slack/utils/security'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-02-11 00:00:00.000000000 Z
10
+ date: 2025-05-24 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: faraday
@@ -94,7 +93,6 @@ dependencies:
94
93
  - - ">="
95
94
  - !ruby/object:Gem::Version
96
95
  version: '0'
97
- description:
98
96
  email: dblock@dblock.org
99
97
  executables:
100
98
  - slack
@@ -166,6 +164,7 @@ files:
166
164
  - bin/commands/apps_datastore.rb
167
165
  - bin/commands/apps_event_authorizations.rb
168
166
  - bin/commands/apps_manifest.rb
167
+ - bin/commands/assistant_search.rb
169
168
  - bin/commands/assistant_threads.rb
170
169
  - bin/commands/auth.rb
171
170
  - bin/commands/auth_teams.rb
@@ -269,6 +268,7 @@ files:
269
268
  - lib/slack/real_time/stores/base.rb
270
269
  - lib/slack/real_time/stores/starter.rb
271
270
  - lib/slack/real_time/stores/store.rb
271
+ - lib/slack/utils/security.rb
272
272
  - lib/slack/version.rb
273
273
  - lib/slack/web/api/endpoints.rb
274
274
  - lib/slack/web/api/endpoints/admin_analytics.rb
@@ -311,6 +311,7 @@ files:
311
311
  - lib/slack/web/api/endpoints/apps_datastore.rb
312
312
  - lib/slack/web/api/endpoints/apps_event_authorizations.rb
313
313
  - lib/slack/web/api/endpoints/apps_manifest.rb
314
+ - lib/slack/web/api/endpoints/assistant_search.rb
314
315
  - lib/slack/web/api/endpoints/assistant_threads.rb
315
316
  - lib/slack/web/api/endpoints/auth.rb
316
317
  - lib/slack/web/api/endpoints/auth_teams.rb
@@ -407,7 +408,6 @@ licenses:
407
408
  metadata:
408
409
  rubygems_mfa_required: 'true'
409
410
  changelog_uri: https://github.com/slack-ruby/slack-ruby-client/blob/master/CHANGELOG.md
410
- post_install_message:
411
411
  rdoc_options: []
412
412
  require_paths:
413
413
  - lib
@@ -422,8 +422,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
422
422
  - !ruby/object:Gem::Version
423
423
  version: 1.3.6
424
424
  requirements: []
425
- rubygems_version: 3.5.16
426
- signing_key:
425
+ rubygems_version: 3.6.2
427
426
  specification_version: 4
428
427
  summary: Slack Web and RealTime API client.
429
428
  test_files: []