slack-ruby-client 2.6.0 → 3.0.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.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +4 -10
- data/.github/workflows/update_api.yml +1 -1
- data/.rubocop_todo.yml +58 -71
- data/CHANGELOG.md +15 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +0 -9
- data/LICENSE.md +1 -1
- data/README.md +31 -220
- data/Rakefile +0 -1
- data/UPGRADING.md +4 -0
- data/bin/commands/admin_analytics.rb +1 -1
- data/bin/commands/admin_apps.rb +4 -4
- data/bin/commands/admin_apps_activities.rb +7 -7
- data/bin/commands/admin_apps_approved.rb +4 -4
- data/bin/commands/admin_apps_config.rb +3 -1
- data/bin/commands/admin_apps_requests.rb +5 -5
- data/bin/commands/admin_apps_restricted.rb +4 -4
- data/bin/commands/admin_audit_anomaly_allow.rb +6 -6
- data/bin/commands/admin_auth_policy.rb +5 -5
- data/bin/commands/admin_barriers.rb +3 -3
- data/bin/commands/admin_conversations.rb +15 -15
- data/bin/commands/admin_conversations_ekm.rb +2 -2
- data/bin/commands/admin_conversations_restrictAccess.rb +5 -5
- data/bin/commands/admin_emoji.rb +5 -5
- data/bin/commands/admin_functions.rb +1 -1
- data/bin/commands/admin_inviteRequests.rb +3 -3
- data/bin/commands/admin_inviteRequests_approved.rb +1 -1
- data/bin/commands/admin_inviteRequests_denied.rb +1 -1
- data/bin/commands/admin_roles.rb +3 -3
- data/bin/commands/admin_teams.rb +3 -3
- data/bin/commands/admin_teams_admins.rb +2 -2
- data/bin/commands/admin_teams_owners.rb +2 -2
- data/bin/commands/admin_teams_settings.rb +5 -5
- data/bin/commands/admin_usergroups.rb +4 -4
- data/bin/commands/admin_users.rb +12 -11
- data/bin/commands/admin_users_session.rb +6 -5
- data/bin/commands/admin_users_unsupportedVersions.rb +1 -1
- data/bin/commands/admin_workflows.rb +6 -6
- data/bin/commands/admin_workflows_collaborators.rb +2 -2
- data/bin/commands/apps_activities.rb +7 -7
- data/bin/commands/apps_auth_external.rb +1 -1
- data/bin/commands/apps_datastore.rb +12 -12
- data/bin/commands/apps_event_authorizations.rb +3 -3
- data/bin/commands/apps_manifest.rb +1 -1
- data/bin/commands/assistant_search.rb +18 -2
- data/bin/commands/assistant_threads.rb +2 -2
- data/bin/commands/auth.rb +1 -1
- data/bin/commands/auth_teams.rb +1 -1
- data/bin/commands/bookmarks.rb +6 -6
- data/bin/commands/calls.rb +5 -5
- data/bin/commands/canvases.rb +2 -2
- data/bin/commands/canvases_access.rb +1 -1
- data/bin/commands/chat.rb +23 -24
- data/bin/commands/conversations.rb +8 -8
- data/bin/commands/conversations_canvases.rb +1 -1
- data/bin/commands/conversations_externalInvitePermissions.rb +1 -1
- data/bin/commands/conversations_requestSharedInvite.rb +4 -4
- data/bin/commands/dnd.rb +1 -1
- data/bin/commands/files.rb +5 -5
- data/bin/commands/files_remote.rb +1 -1
- data/bin/commands/functions.rb +1 -1
- data/bin/commands/functions_distributions_permissions.rb +15 -15
- data/bin/commands/functions_workflows_steps.rb +2 -2
- data/bin/commands/functions_workflows_steps_responses.rb +2 -2
- data/bin/commands/migration.rb +2 -2
- data/bin/commands/oauth_v2.rb +1 -1
- data/bin/commands/openid_connect.rb +1 -1
- data/bin/commands/reactions.rb +3 -3
- data/bin/commands/reminders.rb +2 -2
- data/bin/commands/rtm.rb +15 -0
- data/bin/commands/search.rb +4 -4
- data/bin/commands/slackLists.rb +37 -0
- data/bin/commands/slackLists_access.rb +34 -0
- data/bin/commands/slackLists_download.rb +31 -0
- data/bin/commands/slackLists_items.rb +76 -0
- data/bin/commands/team.rb +1 -1
- data/bin/commands/team_externalTeams.rb +4 -4
- data/bin/commands/usergroups.rb +10 -10
- data/bin/commands/usergroups_users.rb +5 -5
- data/bin/commands/users.rb +1 -1
- data/bin/commands/users_discoverableContacts.rb +1 -1
- data/bin/commands/views.rb +4 -4
- data/bin/commands/workflows_featured.rb +50 -0
- data/bin/commands/workflows_triggers_permissions.rb +7 -7
- data/examples/files_upload_v2/files_upload_v2.rb +8 -0
- data/lib/slack/events/request.rb +1 -0
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_apps_activities.rb +14 -14
- data/lib/slack/web/api/endpoints/admin_apps_approved.rb +5 -7
- data/lib/slack/web/api/endpoints/admin_apps_config.rb +6 -3
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +7 -9
- data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +5 -7
- data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +5 -5
- data/lib/slack/web/api/endpoints/admin_auth_policy.rb +14 -14
- data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_conversations.rb +27 -28
- data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +4 -4
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +11 -12
- data/lib/slack/web/api/endpoints/admin_emoji.rb +5 -5
- data/lib/slack/web/api/endpoints/admin_functions.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +6 -6
- data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_roles.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_teams.rb +3 -3
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +3 -4
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +2 -3
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +12 -13
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +11 -11
- data/lib/slack/web/api/endpoints/admin_users.rb +27 -25
- data/lib/slack/web/api/endpoints/admin_users_session.rb +12 -9
- data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_workflows.rb +12 -12
- data/lib/slack/web/api/endpoints/admin_workflows_collaborators.rb +6 -6
- data/lib/slack/web/api/endpoints/apps_activities.rb +14 -14
- data/lib/slack/web/api/endpoints/apps_auth_external.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_datastore.rb +8 -15
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +0 -3
- data/lib/slack/web/api/endpoints/apps_manifest.rb +5 -5
- data/lib/slack/web/api/endpoints/assistant_search.rb +28 -3
- data/lib/slack/web/api/endpoints/assistant_threads.rb +6 -6
- data/lib/slack/web/api/endpoints/auth.rb +1 -1
- data/lib/slack/web/api/endpoints/auth_teams.rb +2 -2
- data/lib/slack/web/api/endpoints/bookmarks.rb +14 -14
- data/lib/slack/web/api/endpoints/calls.rb +10 -10
- data/lib/slack/web/api/endpoints/canvases.rb +4 -4
- data/lib/slack/web/api/endpoints/canvases_access.rb +3 -3
- data/lib/slack/web/api/endpoints/chat.rb +53 -55
- data/lib/slack/web/api/endpoints/conversations.rb +16 -16
- data/lib/slack/web/api/endpoints/conversations_canvases.rb +1 -1
- data/lib/slack/web/api/endpoints/conversations_externalInvitePermissions.rb +3 -3
- data/lib/slack/web/api/endpoints/conversations_requestSharedInvite.rb +8 -8
- data/lib/slack/web/api/endpoints/dnd.rb +2 -2
- data/lib/slack/web/api/endpoints/files.rb +11 -11
- data/lib/slack/web/api/endpoints/files_remote.rb +2 -2
- data/lib/slack/web/api/endpoints/functions.rb +3 -3
- data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +24 -24
- data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +4 -4
- data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +4 -4
- data/lib/slack/web/api/endpoints/migration.rb +1 -1
- data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
- data/lib/slack/web/api/endpoints/openid_connect.rb +2 -2
- data/lib/slack/web/api/endpoints/reactions.rb +6 -6
- data/lib/slack/web/api/endpoints/reminders.rb +4 -4
- data/lib/slack/web/api/endpoints/rtm.rb +23 -0
- data/lib/slack/web/api/endpoints/search.rb +8 -8
- data/lib/slack/web/api/endpoints/slackLists.rb +52 -0
- data/lib/slack/web/api/endpoints/slackLists_access.rb +47 -0
- data/lib/slack/web/api/endpoints/slackLists_download.rb +40 -0
- data/lib/slack/web/api/endpoints/slackLists_items.rb +116 -0
- data/lib/slack/web/api/endpoints/team.rb +3 -3
- data/lib/slack/web/api/endpoints/team_externalTeams.rb +8 -8
- data/lib/slack/web/api/endpoints/usergroups.rb +18 -18
- data/lib/slack/web/api/endpoints/usergroups_users.rb +8 -8
- data/lib/slack/web/api/endpoints/users.rb +2 -2
- data/lib/slack/web/api/endpoints/users_discoverableContacts.rb +0 -1
- data/lib/slack/web/api/endpoints/views.rb +9 -9
- data/lib/slack/web/api/endpoints/workflows_featured.rb +69 -0
- data/lib/slack/web/api/endpoints/workflows_triggers_permissions.rb +15 -15
- data/lib/slack/web/api/endpoints.rb +10 -2
- data/lib/slack/web/api/errors.rb +88 -46
- data/lib/slack/web/api/helpers/files.rb +32 -22
- data/lib/slack/web/api/mixins/conversations.id.rb +14 -3
- data/lib/slack/web/api/mixins/users.id.rb +7 -3
- data/lib/slack/web/faraday/response/raise_error.rb +20 -2
- data/lib/slack-ruby-client.rb +0 -12
- data/lib/tasks/update.rake +0 -1
- data/lib/tasks/web.rake +0 -4
- data/slack-ruby-client.gemspec +1 -1
- metadata +19 -38
- data/.github/workflows/integration_test.yml +0 -45
- data/bin/commands/workflows.rb +0 -44
- data/examples/hi_real_time_and_web/Gemfile +0 -6
- data/examples/hi_real_time_and_web/hi.gif +0 -0
- data/examples/hi_real_time_and_web/hi.rb +0 -28
- data/examples/hi_real_time_async_async/Gemfile +0 -7
- data/examples/hi_real_time_async_async/Procfile +0 -2
- data/examples/hi_real_time_async_async/hi.rb +0 -41
- data/lib/slack/real_time/api/message.rb +0 -23
- data/lib/slack/real_time/api/message_id.rb +0 -15
- data/lib/slack/real_time/api/ping.rb +0 -19
- data/lib/slack/real_time/api/schema/event.json +0 -23
- data/lib/slack/real_time/api/templates/event_handler.erb +0 -8
- data/lib/slack/real_time/api/typing.rb +0 -20
- data/lib/slack/real_time/client.rb +0 -271
- data/lib/slack/real_time/concurrency/async.rb +0 -142
- data/lib/slack/real_time/concurrency.rb +0 -8
- data/lib/slack/real_time/config.rb +0 -62
- data/lib/slack/real_time/models/base.rb +0 -11
- data/lib/slack/real_time/models/bot.rb +0 -9
- data/lib/slack/real_time/models/channel.rb +0 -13
- data/lib/slack/real_time/models/im.rb +0 -9
- data/lib/slack/real_time/models/mpim.rb +0 -9
- data/lib/slack/real_time/models/team.rb +0 -9
- data/lib/slack/real_time/models/user.rb +0 -9
- data/lib/slack/real_time/models.rb +0 -9
- data/lib/slack/real_time/socket.rb +0 -118
- data/lib/slack/real_time/stores/base.rb +0 -47
- data/lib/slack/real_time/stores/starter.rb +0 -449
- data/lib/slack/real_time/stores/store.rb +0 -624
- data/lib/slack/real_time/stores.rb +0 -5
- data/lib/slack/web/api/endpoints/workflows.rb +0 -63
- data/lib/tasks/real_time.rake +0 -81
data/README.md
CHANGED
@@ -2,12 +2,10 @@ Slack Ruby Client
|
|
2
2
|
=================
|
3
3
|
|
4
4
|
[](http://badge.fury.io/rb/slack-ruby-client)
|
5
|
-
[](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/integration_test.yml)
|
6
5
|
[](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/test.yml)
|
7
|
-
[](https://codeclimate.com/github/slack-ruby/slack-ruby-client)
|
8
6
|
[](https://coveralls.io/github/slack-ruby/slack-ruby-client?branch=master)
|
9
7
|
|
10
|
-
A Ruby client for the Slack [Web](https://api.slack.com/web)
|
8
|
+
A Ruby client for the Slack [Web](https://api.slack.com/web) and [Events](https://api.slack.com/events-api) APIs. Comes with a handy command-line client, too. If you are not familiar with these concepts, you might want to watch [this video](http://code.dblock.org/2016/03/11/your-first-slack-bot-service-video.html).
|
11
9
|
|
12
10
|

|
13
11
|
|
@@ -39,16 +37,6 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
39
37
|
- [Slack Errors](#slack-errors)
|
40
38
|
- [Rate Limiting](#rate-limiting)
|
41
39
|
- [Other Errors](#other-errors)
|
42
|
-
- [RealTime Client](#realtime-client)
|
43
|
-
- [Configuring Slack::RealTime::Client](#configuring-slackrealtimeclient)
|
44
|
-
- [Caveats](#caveats)
|
45
|
-
- [websocket_ping](#websocket_ping)
|
46
|
-
- [RealTime Store](#realtime-store)
|
47
|
-
- [Slack::RealTime::Stores::Starter](#slackrealtimestoresstarter)
|
48
|
-
- [Slack::RealTime::Stores::Store](#slackrealtimestoresstore)
|
49
|
-
- [Combining RealTime and Web Clients](#combining-realtime-and-web-clients)
|
50
|
-
- [Concurrency](#concurrency)
|
51
|
-
- [Async](#async)
|
52
40
|
- [Events API](#events-api)
|
53
41
|
- [Configuring Slack::Events](#configuring-slackevents)
|
54
42
|
- [Verifying the Request Signature](#verifying-the-request-signature)
|
@@ -68,7 +56,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
68
56
|
- [Send a Message](#send-a-message)
|
69
57
|
- [Get Channel Info](#get-channel-info-1)
|
70
58
|
- [List Users](#list-users)
|
71
|
-
- [Enterprise Support](#enterprise-support)
|
59
|
+
- [Sponsorship and Enterprise Support](#sponsorship-and-enterprise-support)
|
72
60
|
- [History](#history)
|
73
61
|
- [Security](#security)
|
74
62
|
- [Contributing](#contributing)
|
@@ -76,13 +64,13 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
76
64
|
|
77
65
|
## Useful to Me?
|
78
66
|
|
79
|
-
* This library lets you send messages to Slack via the Web API
|
67
|
+
* This library lets you send messages to Slack via the Web API and facilitates integration with the Events API.
|
80
68
|
* To write a complete bot for Slack you need more than this library, and it's much easier to start with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events).
|
81
69
|
* To respond to slash commands, interactive components, or events at the lowest level, implement a web application using your favorite web framework, and use this library to call the Slack Web API, and to verify that events are coming from Slack.
|
82
70
|
|
83
71
|
## Stable Release
|
84
72
|
|
85
|
-
You're reading the documentation for the **stable** release of slack-ruby-client. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
73
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, v3.0.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
86
74
|
|
87
75
|
## Installation
|
88
76
|
|
@@ -92,12 +80,6 @@ Add to Gemfile.
|
|
92
80
|
gem 'slack-ruby-client'
|
93
81
|
```
|
94
82
|
|
95
|
-
If you're going to be using the RealTime client, add `async-websocket`. See below for more information about concurrency.
|
96
|
-
|
97
|
-
```
|
98
|
-
gem 'async-websocket', '~> 0.8.0'
|
99
|
-
```
|
100
|
-
|
101
83
|
Run `bundle install`.
|
102
84
|
|
103
85
|
## Usage
|
@@ -174,6 +156,8 @@ Upload files with [sequenced API calls](https://api.slack.com/messaging/files#up
|
|
174
156
|
|
175
157
|
This library provides a helper method `files_upload_v2` that wraps the three separate API calls.
|
176
158
|
|
159
|
+
Upload a single file.
|
160
|
+
|
177
161
|
```ruby
|
178
162
|
client.files_upload_v2(
|
179
163
|
# required options
|
@@ -189,6 +173,19 @@ client.files_upload_v2(
|
|
189
173
|
)
|
190
174
|
```
|
191
175
|
|
176
|
+
Upload multiple files.
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
client.files_upload_v2(
|
180
|
+
files: [
|
181
|
+
{ filename: 'report.pdf', content: File.read('/users/me/report.pdf'), title: 'Monthly Report' },
|
182
|
+
{ filename: 'data.csv', content: File.read('/users/me/data.csv'), title: 'Raw Data' }
|
183
|
+
],
|
184
|
+
channels: ['#general'],
|
185
|
+
initial_comment: 'Here are the monthly results!'
|
186
|
+
)
|
187
|
+
```
|
188
|
+
|
192
189
|
You can use a channel ID passed as `channel_id`, a single channel as `channel`, an array of channel IDs as `channels`, or a channel name or names (prefixed with `#`) in `files_upload_v2`. Lookup by name is not supported by the Slack API and this method called invokes `conversations_list` in order to locate the channel ID. This invocation can have a cost if you have many Slack channels and is only recommended when you intend to list channels anyway.
|
193
190
|
|
194
191
|
Note: This library includes a `files_upload` method that uses a deprecated endpoint `files.upload` that will [no longer be supported on 3/11/2025](https://api.slack.com/methods/files.upload#markdown).
|
@@ -271,12 +268,12 @@ You can configure the Web client either globally or via the initializer.
|
|
271
268
|
|
272
269
|
```ruby
|
273
270
|
Slack::Web::Client.configure do |config|
|
274
|
-
config.user_agent = 'Slack Ruby Client/
|
271
|
+
config.user_agent = 'Slack Ruby Client/3.0'
|
275
272
|
end
|
276
273
|
```
|
277
274
|
|
278
275
|
```ruby
|
279
|
-
client = Slack::Web::Client.new(user_agent: 'Slack Ruby Client/
|
276
|
+
client = Slack::Web::Client.new(user_agent: 'Slack Ruby Client/3.0')
|
280
277
|
```
|
281
278
|
|
282
279
|
The following settings are supported.
|
@@ -304,7 +301,7 @@ You can also pass request options, including `timeout` and `open_timeout` into i
|
|
304
301
|
client.conversations_list(request: { timeout: 180 })
|
305
302
|
```
|
306
303
|
|
307
|
-
You can
|
304
|
+
You can control what proxy options are used by modifying the `http_proxy` environment variable per [Net::HTTP's documentation](https://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html#class-Net::HTTP-label-Proxies).
|
308
305
|
|
309
306
|
Note that Docker on OSX seems to incorrectly set the proxy, causing `Faraday::ConnectionFailed, ERROR -- : Failed to open TCP connection to : (getaddrinfo: Name or service not known)`. You might need to manually unset `http_proxy` in that case, eg. `http_proxy="" bundle exec ruby ./my_bot.rb`.
|
310
307
|
|
@@ -388,194 +385,6 @@ Specifically `Slack::Web::Api::Errors::ParsingError` will be raised on non-json
|
|
388
385
|
|
389
386
|
In any other case, a `Faraday::ClientError` will be raised.
|
390
387
|
|
391
|
-
### RealTime Client
|
392
|
-
|
393
|
-
The Real Time Messaging API is a WebSocket-based API that allows you to receive events from Slack in real time and send messages as user.
|
394
|
-
|
395
|
-
```ruby
|
396
|
-
client = Slack::RealTime::Client.new
|
397
|
-
|
398
|
-
client.on :hello do
|
399
|
-
puts "Successfully connected, welcome '#{client.self.name}' to the '#{client.team.name}' team at https://#{client.team.domain}.slack.com."
|
400
|
-
end
|
401
|
-
|
402
|
-
client.on :message do |data|
|
403
|
-
case data.text
|
404
|
-
when 'bot hi' then
|
405
|
-
client.message(channel: data.channel, text: "Hi <@#{data.user}>!")
|
406
|
-
when /^bot/ then
|
407
|
-
client.message(channel: data.channel, text: "Sorry <@#{data.user}>, what?")
|
408
|
-
end
|
409
|
-
end
|
410
|
-
|
411
|
-
client.on :close do |_data|
|
412
|
-
puts "Client is about to disconnect"
|
413
|
-
end
|
414
|
-
|
415
|
-
client.on :closed do |_data|
|
416
|
-
puts "Client has disconnected successfully!"
|
417
|
-
end
|
418
|
-
|
419
|
-
client.start!
|
420
|
-
```
|
421
|
-
|
422
|
-
You can send typing indicators with `typing`.
|
423
|
-
|
424
|
-
```ruby
|
425
|
-
client.typing channel: data.channel
|
426
|
-
```
|
427
|
-
|
428
|
-
You can send a ping with `ping`.
|
429
|
-
|
430
|
-
```ruby
|
431
|
-
client.ping
|
432
|
-
```
|
433
|
-
|
434
|
-
#### Configuring Slack::RealTime::Client
|
435
|
-
|
436
|
-
You can configure the RealTime client either globally or via the initializer.
|
437
|
-
|
438
|
-
```ruby
|
439
|
-
Slack::RealTime::Client.configure do |config|
|
440
|
-
config.websocket_ping = 42
|
441
|
-
end
|
442
|
-
```
|
443
|
-
|
444
|
-
```ruby
|
445
|
-
client = Slack::RealTime::Client.new(websocket_ping: 42)
|
446
|
-
```
|
447
|
-
|
448
|
-
The following settings are supported.
|
449
|
-
|
450
|
-
setting | description
|
451
|
-
----------------|-----------------------------------------------------------------------------------------------------
|
452
|
-
token | Slack API token.
|
453
|
-
websocket_ping | How long the socket can be idle before sending a ping message to confirm it's still connected, default is 30.
|
454
|
-
websocket_proxy | Connect via proxy, include `:origin` and `:headers`.
|
455
|
-
start_options | Options to pass to `rtm.connect`, default is `{ request: { timeout: 180 } }`.
|
456
|
-
store_class | Local store class, default is an in-memory `Slack::RealTime::Stores::Starter`.
|
457
|
-
store_options | Options to initialize the store, default is `{}`.
|
458
|
-
async_handlers | Option to run handlers asynchronously. Valid options are `:all` or `:none`, default is `:none`.
|
459
|
-
logger | Optional `Logger` instance that logs RealTime requests and socket data.
|
460
|
-
|
461
|
-
Note that the RealTime client uses a Web client to obtain the WebSocket URL via [rtm.connect](https://api.slack.com/methods/rtm.connect). While `token` and `logger` options are passed down from the RealTime client, you may also configure Web client options via `Slack::Web::Client.configure` as described above.
|
462
|
-
|
463
|
-
See a fully working example in [examples/hi_real_time_and_web](examples/hi_real_time_and_web/hi.rb).
|
464
|
-
|
465
|
-

|
466
|
-
|
467
|
-
##### Caveats
|
468
|
-
|
469
|
-
###### `websocket_ping`
|
470
|
-
|
471
|
-
This setting determines how long the socket can be idle before sending a ping message to confirm it's still connected.
|
472
|
-
|
473
|
-
It's important to note that if a ping message was sent and no response was received within the amount of time specified in `websocket_ping` the client will attempt to reestablish it's connection to the message server.
|
474
|
-
|
475
|
-
Note that the ping may take between `websocket_ping` and `websocket_ping * 3/2` seconds to actually trigger when there is no activity on the socket. This is because the timer that checks whether to ping is triggered at every `websocket_ping / 2` interval.
|
476
|
-
|
477
|
-
To disable this feature set `websocket_ping` to 0.
|
478
|
-
|
479
|
-
#### RealTime Store
|
480
|
-
|
481
|
-
The RealTime client exposes and maintains a local store upon successful connection.
|
482
|
-
Event hooks keep the store's cached data up-to-date.
|
483
|
-
|
484
|
-
Tracking with a local store can be disabled with `Slack::RealTime::Client.new(store_class: nil)`.
|
485
|
-
|
486
|
-
##### `Slack::RealTime::Stores::Starter`
|
487
|
-
|
488
|
-
A small store that only caches and tracks data returned in the [rtm.connect](https://api.slack.com/methods/rtm.connect#examples) response.
|
489
|
-
This store provides `self` and `team` for accessing the limited data about the authenticated user and its workspace, but does not cache other users or bots, channels, or direct messages.
|
490
|
-
|
491
|
-
##### `Slack::RealTime::Stores::Store`
|
492
|
-
|
493
|
-
A more complete store that tracks most changes visible to the authenticated user.
|
494
|
-
|
495
|
-
You can see all of the cache types in the table below (each is a hash indexed by its objects' `id`).
|
496
|
-
|
497
|
-
Cache | Description
|
498
|
-
-------------------|-------------------------------------------------------------------------------------------------
|
499
|
-
`teams` | Workspaces (teams). Will likely contain only one `team`.
|
500
|
-
`users` | All [user](https://api.slack.com/types/user) objects, including `self`.
|
501
|
-
`bots` | All [bot users](https://api.slack.com/bot-users) (from Slack Apps and legacy custom integrations).
|
502
|
-
`public_channels` | Public [conversation](https://api.slack.com/types/conversation) objects.
|
503
|
-
`private_channels` | Private [conversation](https://api.slack.com/types/conversation) and [group](https://api.slack.com/types/group) objects with the authenticated user as a member.
|
504
|
-
`ims` | Visible [im](https://api.slack.com/types/im) objects, direct message channels with the authenticated user.
|
505
|
-
`mpims` | Visible [mpim](https://api.slack.com/types/mpim) objects, multiparty direct message channels that include the authenticated user.
|
506
|
-
|
507
|
-
By default, none of these caches are initialized with data beyond what is returned from [rtm.connect](https://api.slack.com/methods/rtm.connect#examples), same as [Slack::RealTime::Stores::Starter](#slackrealtimestoresstarter).
|
508
|
-
When configured, this store initializes its caches by making additional calls to Web API methods upon successful connection to the RTM API (i.e. "hello" message).
|
509
|
-
|
510
|
-
Configure by specifying which caches to fetch:
|
511
|
-
```ruby
|
512
|
-
Slack::RealTime::Client.configure do |config|
|
513
|
-
config.store_class = Slack::RealTime::Stores::Store
|
514
|
-
config.store_options = { caches: %i[teams users public_channels private_channels ims] }
|
515
|
-
end
|
516
|
-
```
|
517
|
-
or with the `:all` option:
|
518
|
-
```ruby
|
519
|
-
Slack::RealTime::Client.configure do |config|
|
520
|
-
config.store_class = Slack::RealTime::Stores::Store
|
521
|
-
config.store_options = { caches: :all }
|
522
|
-
end
|
523
|
-
```
|
524
|
-
|
525
|
-
Note: For `teams`, this makes a single call to `team.info`, while for `users` and all conversation-like types, this makes paginated calls to `users.list` and `conversations.list` respectively.
|
526
|
-
Only `bots` requires a separate call for every bot user, so may be slow if your workplace has a lot of bot users.
|
527
|
-
|
528
|
-
### Combining RealTime and Web Clients
|
529
|
-
|
530
|
-
Since the Web client is used to obtain the RealTime client's WebSocket URL, you can continue using the Web client in combination with the RealTime client.
|
531
|
-
|
532
|
-
```ruby
|
533
|
-
client = Slack::RealTime::Client.new
|
534
|
-
|
535
|
-
client.on :message do |data|
|
536
|
-
case data.text
|
537
|
-
when 'bot hi' then
|
538
|
-
client.web_client.chat_postMessage(channel: data.channel, text: "Hi <@#{data.user}>!")
|
539
|
-
when /^bot/ then
|
540
|
-
client.web_client.chat_postMessage(channel: data.channel, text: "Sorry <@#{data.user}>, what?")
|
541
|
-
end
|
542
|
-
end
|
543
|
-
|
544
|
-
client.start!
|
545
|
-
```
|
546
|
-
|
547
|
-
See a fully working example in [examples/hi_real_time_and_web](examples/hi_real_time_and_web/hi.rb).
|
548
|
-
|
549
|
-

|
550
|
-
|
551
|
-
#### Concurrency
|
552
|
-
|
553
|
-
`Slack::RealTime::Client` needs help from a concurrency library and supports [Async](https://github.com/socketry/async).
|
554
|
-
|
555
|
-
```ruby
|
556
|
-
Slack::RealTime.configure do |config|
|
557
|
-
config.concurrency = Slack::RealTime::Concurrency::Async
|
558
|
-
end
|
559
|
-
```
|
560
|
-
|
561
|
-
Use `client.start_async` instead of `client.start!`. A good example of such application is [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server).
|
562
|
-
|
563
|
-
```ruby
|
564
|
-
client = Slack::RealTime::Client.new
|
565
|
-
|
566
|
-
client.start_async
|
567
|
-
```
|
568
|
-
|
569
|
-
##### Async
|
570
|
-
|
571
|
-
Add `async-websocket` to your Gemfile.
|
572
|
-
|
573
|
-
```
|
574
|
-
gem 'async-websocket'
|
575
|
-
```
|
576
|
-
|
577
|
-
See a fully working example in [examples/hi_real_time_async_async](examples/hi_real_time_async_async/hi.rb).
|
578
|
-
|
579
388
|
### Events API
|
580
389
|
|
581
390
|
This library provides limited support for the [Slack Events API](https://api.slack.com/events-api).
|
@@ -608,9 +417,11 @@ slack_request.verify!
|
|
608
417
|
|
609
418
|
To specify secrets on a per-request basis:
|
610
419
|
```ruby
|
611
|
-
Slack::Events::Request.new(
|
612
|
-
|
613
|
-
|
420
|
+
Slack::Events::Request.new(
|
421
|
+
http_request,
|
422
|
+
signing_secret: signing_secret,
|
423
|
+
signature_expires_in: signature_expires_in
|
424
|
+
)
|
614
425
|
```
|
615
426
|
|
616
427
|
The `verify!` call may raise `Slack::Events::Request::MissingSigningSecret`, `Slack::Events::Request::InvalidSignature` or `Slack::Events::Request::TimestampExpired` errors.
|
@@ -793,11 +604,11 @@ $ slack users list | jq '.members | map({(.id): .name})'
|
|
793
604
|
|
794
605
|
See `slack help` for a complete command-line reference.
|
795
606
|
|
796
|
-
## Enterprise Support
|
607
|
+
## Sponsorship and Enterprise Support
|
797
608
|
|
798
|
-
|
609
|
+
This library was created and has been maintained for a decade by [@dblock](https://github.com/dblock). Please consider [a sponsorship](https://github.com/sponsors/dblock).
|
799
610
|
|
800
|
-
|
611
|
+
Enterprise Support is available as part of a Tidelift Subscription. Click [here](https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-slack-ruby-client&utm_medium=referral&utm_campaign=enterprise) for more details.
|
801
612
|
|
802
613
|
## History
|
803
614
|
|
@@ -813,6 +624,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
|
|
813
624
|
|
814
625
|
## Copyright and License
|
815
626
|
|
816
|
-
Copyright (c) 2015-
|
627
|
+
Copyright (c) 2015-2025, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
|
817
628
|
|
818
629
|
This project is licensed under the [MIT License](LICENSE.md).
|
data/Rakefile
CHANGED
data/UPGRADING.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
Upgrading Slack-Ruby-Client
|
2
2
|
===========================
|
3
3
|
|
4
|
+
### Upgrading to >= 3.0.0
|
5
|
+
|
6
|
+
Support for the [RTM API](https://docs.slack.dev/tools/java-slack-sdk/guides/rtm/) has been removed in [#573](https://github.com/slack-ruby/slack-ruby-client/pull/573). By now you should have [migrated your app to granular permissions](https://code.dblock.org/2020/11/30/migrating-classic-slack-ruby-bots-to-granular-permissions.html), and you should lock your slack-ruby-client to 2.x for those bots. Next, to remove RTM components we found it more effective to just [write a new version of a bot](https://code.dblock.org/2024/06/30/writing-a-channel-slack-bot.html) and avoid a complex migration.
|
7
|
+
|
4
8
|
### Upgrading to >= 2.0.0
|
5
9
|
|
6
10
|
[#416](https://github.com/slack-ruby/slack-ruby-client/pull/416) Removes default values for Faraday's SSL settings `ca_file` and `ca_path`.
|
@@ -9,8 +9,8 @@ module Slack
|
|
9
9
|
g.desc 'Retrieve analytics data for a given date, presented as a compressed JSON file'
|
10
10
|
g.long_desc %( Retrieve analytics data for a given date, presented as a compressed JSON file )
|
11
11
|
g.command 'getFile' do |c|
|
12
|
-
c.flag 'type', desc: 'The type of analytics to retrieve. The options are currently limited to member (for grid member analytics) and public_channel (for public channel analytics).'
|
13
12
|
c.flag 'date', desc: 'Date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC. Required unless metadata_only is set to true.'
|
13
|
+
c.flag 'type', desc: 'The type of analytics to retrieve. The options are currently limited to member (for Enterprise org member analytics) and public_channel (for public channel analytics).'
|
14
14
|
c.flag 'metadata_only', desc: 'Retrieve metadata for the type of analytics indicated. Can be used only with type set to public_channel analytics. See detail below. Omit the date parameter when using this argument.'
|
15
15
|
c.action do |_global_options, options, _args|
|
16
16
|
puts JSON.dump(@client.admin_analytics_getFile(options))
|
data/bin/commands/admin_apps.rb
CHANGED
@@ -10,9 +10,9 @@ module Slack
|
|
10
10
|
g.long_desc %( Approve an app for installation on a workspace. )
|
11
11
|
g.command 'approve' do |c|
|
12
12
|
c.flag 'app_id', desc: 'The id of the app to approve.'
|
13
|
-
c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
|
14
13
|
c.flag 'request_id', desc: 'The id of the request to approve.'
|
15
14
|
c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
|
15
|
+
c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
|
16
16
|
c.action do |_global_options, options, _args|
|
17
17
|
puts JSON.dump(@client.admin_apps_approve(options))
|
18
18
|
end
|
@@ -22,8 +22,8 @@ module Slack
|
|
22
22
|
g.long_desc %( Clear an app resolution )
|
23
23
|
g.command 'clearResolution' do |c|
|
24
24
|
c.flag 'app_id', desc: 'The id of the app whose resolution you want to clear/undo.'
|
25
|
-
c.flag 'enterprise_id', desc: 'The enterprise to clear the app resolution from.'
|
26
25
|
c.flag 'team_id', desc: 'The workspace to clear the app resolution from.'
|
26
|
+
c.flag 'enterprise_id', desc: 'The enterprise to clear the app resolution from.'
|
27
27
|
c.action do |_global_options, options, _args|
|
28
28
|
puts JSON.dump(@client.admin_apps_clearResolution(options))
|
29
29
|
end
|
@@ -33,9 +33,9 @@ module Slack
|
|
33
33
|
g.long_desc %( Restrict an app for installation on a workspace. )
|
34
34
|
g.command 'restrict' do |c|
|
35
35
|
c.flag 'app_id', desc: 'The id of the app to restrict.'
|
36
|
-
c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
|
37
36
|
c.flag 'request_id', desc: 'The id of the request to restrict.'
|
38
37
|
c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
|
38
|
+
c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
|
39
39
|
c.action do |_global_options, options, _args|
|
40
40
|
puts JSON.dump(@client.admin_apps_restrict(options))
|
41
41
|
end
|
@@ -45,8 +45,8 @@ module Slack
|
|
45
45
|
g.long_desc %( Uninstall an app from one or many workspaces, or an entire enterprise organization. )
|
46
46
|
g.command 'uninstall' do |c|
|
47
47
|
c.flag 'app_id', desc: 'The ID of the app to uninstall.'
|
48
|
-
c.flag 'enterprise_id', desc: 'The enterprise to completely uninstall the application from (across all workspaces). With an org-level token, this or team_ids is required.'
|
49
48
|
c.flag 'team_ids', desc: 'IDs of the teams to uninstall from (max 100). With an org-level token, this or enterprise_id is required.'
|
49
|
+
c.flag 'enterprise_id', desc: 'The enterprise to completely uninstall the application from (across all workspaces). With an org-level token, this or team_ids is required.'
|
50
50
|
c.action do |_global_options, options, _args|
|
51
51
|
puts JSON.dump(@client.admin_apps_uninstall(options))
|
52
52
|
end
|
@@ -10,18 +10,18 @@ module Slack
|
|
10
10
|
g.long_desc %( Get logs for a specified team/org )
|
11
11
|
g.command 'list' do |c|
|
12
12
|
c.flag 'app_id', desc: 'The ID of the app to get activities from.'
|
13
|
-
c.flag '
|
14
|
-
c.flag 'component_type', desc: 'The component type of log events to be returned. Acceptable values are events_api, workflows, functions and tables.'
|
13
|
+
c.flag 'team_id', desc: 'The team who owns this log.'
|
15
14
|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. See pagination for more detail."
|
16
15
|
c.flag 'limit', desc: 'The maximum number of items to return.'
|
17
|
-
c.flag 'log_event_type', desc: 'The event type of log events to be returned.'
|
18
|
-
c.flag 'max_date_created', desc: 'The latest timestamp of the log to retrieve (epoch microseconds).'
|
19
|
-
c.flag 'min_date_created', desc: 'The earliest timestamp of the log to retrieve (epoch microseconds).'
|
20
16
|
c.flag 'min_log_level', desc: 'The minimum log level of the log events to be returned. Defaults to info. Acceptable values (in order of relative importance from smallest to largest) are trace, debug, info, warn, error and fatal.'
|
21
|
-
c.flag '
|
17
|
+
c.flag 'log_event_type', desc: 'The event type of log events to be returned.'
|
22
18
|
c.flag 'source', desc: 'The source of log events to be returned. Acceptable values are slack and developer.'
|
23
|
-
c.flag '
|
19
|
+
c.flag 'component_type', desc: 'The component type of log events to be returned. Acceptable values are events_api, workflows, functions and tables.'
|
20
|
+
c.flag 'component_id', desc: 'The component ID of log events to be returned. Will be FnXXXXXX for functions, and WfXXXXXX for workflows.'
|
24
21
|
c.flag 'trace_id', desc: 'The trace ID of log events to be returned.'
|
22
|
+
c.flag 'min_date_created', desc: 'The earliest timestamp of the log to retrieve (epoch microseconds).'
|
23
|
+
c.flag 'max_date_created', desc: 'The latest timestamp of the log to retrieve (epoch microseconds).'
|
24
|
+
c.flag 'sort_direction', desc: 'The direction you want the data sorted by (always by timestamp).'
|
25
25
|
c.action do |_global_options, options, _args|
|
26
26
|
puts JSON.dump(@client.admin_apps_activities_list(options))
|
27
27
|
end
|
@@ -9,11 +9,11 @@ module Slack
|
|
9
9
|
g.desc 'List approved apps for an org or workspace.'
|
10
10
|
g.long_desc %( List approved apps for an org or workspace. )
|
11
11
|
g.command 'list' do |c|
|
12
|
-
c.flag 'certified', desc: 'Limit the results to only include certified apps. When false, no certified apps will appear in the result.'
|
13
|
-
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
14
|
-
c.flag 'enterprise_id', desc: '.'
|
15
12
|
c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
|
16
|
-
c.flag '
|
13
|
+
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
14
|
+
c.flag 'team_id', desc: ''
|
15
|
+
c.flag 'enterprise_id', desc: ''
|
16
|
+
c.flag 'certified', desc: 'Limit the results to only include certified apps. When false, no certified apps will appear in the result.'
|
17
17
|
c.action do |_global_options, options, _args|
|
18
18
|
puts JSON.dump(@client.admin_apps_approved_list(options))
|
19
19
|
end
|
@@ -10,6 +10,7 @@ module Slack
|
|
10
10
|
g.long_desc %( Look up the app config for connectors by their IDs )
|
11
11
|
g.command 'lookup' do |c|
|
12
12
|
c.flag 'app_ids', desc: 'An array of app IDs to get app configs for.'
|
13
|
+
c.flag 'rich_link_preview_types', desc: 'return apps with the corresponding rich link preview layouts.'
|
13
14
|
c.action do |_global_options, options, _args|
|
14
15
|
puts JSON.dump(@client.admin_apps_config_lookup(options))
|
15
16
|
end
|
@@ -19,8 +20,9 @@ module Slack
|
|
19
20
|
g.long_desc %( Set the app config for a connector )
|
20
21
|
g.command 'set' do |c|
|
21
22
|
c.flag 'app_id', desc: 'The encoded app ID to set the app config for.'
|
22
|
-
c.flag 'domain_restrictions', desc: 'Domain restrictions for the app. Should be an object with two properties: urls and emails. Each is an array of strings, and each sets the allowed URLs and emails for connector authorization, respectively.'
|
23
23
|
c.flag 'workflow_auth_strategy', desc: 'The workflow auth permission. Can be one of builder_choice or end_user_only.'
|
24
|
+
c.flag 'rich_link_preview_type', desc: 'Indicates the app-level override for rich link preview. Unsupported for free teams.'
|
25
|
+
c.flag 'domain_restrictions', desc: 'Domain restrictions for the app. Should be an object with two properties: urls and emails. Each is an array of strings, and each sets the allowed URLs and emails for connector authorization, respectively.'
|
24
26
|
c.action do |_global_options, options, _args|
|
25
27
|
puts JSON.dump(@client.admin_apps_config_set(options))
|
26
28
|
end
|
@@ -10,8 +10,8 @@ module Slack
|
|
10
10
|
g.long_desc %( Cancel app request for team )
|
11
11
|
g.command 'cancel' do |c|
|
12
12
|
c.flag 'request_id', desc: 'The id of the request to cancel.'
|
13
|
-
c.flag 'enterprise_id', desc: 'The ID of the enterprise where this request belongs.'
|
14
13
|
c.flag 'team_id', desc: 'The ID of the workspace where this request belongs.'
|
14
|
+
c.flag 'enterprise_id', desc: 'The ID of the enterprise where this request belongs.'
|
15
15
|
c.action do |_global_options, options, _args|
|
16
16
|
puts JSON.dump(@client.admin_apps_requests_cancel(options))
|
17
17
|
end
|
@@ -20,11 +20,11 @@ module Slack
|
|
20
20
|
g.desc 'List app requests for a team/workspace.'
|
21
21
|
g.long_desc %( List app requests for a team/workspace. )
|
22
22
|
g.command 'list' do |c|
|
23
|
-
c.flag 'certified', desc: 'Include requests for certified apps.'
|
24
|
-
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
25
|
-
c.flag 'enterprise_id', desc: '.'
|
26
23
|
c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
|
27
|
-
c.flag '
|
24
|
+
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
25
|
+
c.flag 'team_id', desc: ''
|
26
|
+
c.flag 'enterprise_id', desc: ''
|
27
|
+
c.flag 'certified', desc: 'Include requests for certified apps.'
|
28
28
|
c.action do |_global_options, options, _args|
|
29
29
|
puts JSON.dump(@client.admin_apps_requests_list(options))
|
30
30
|
end
|
@@ -9,11 +9,11 @@ module Slack
|
|
9
9
|
g.desc 'List restricted apps for an org or workspace.'
|
10
10
|
g.long_desc %( List restricted apps for an org or workspace. )
|
11
11
|
g.command 'list' do |c|
|
12
|
-
c.flag 'certified', desc: 'Limit the results to only include certified apps. When false, no certified apps will appear in the result.'
|
13
|
-
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
14
|
-
c.flag 'enterprise_id', desc: '.'
|
15
12
|
c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
|
16
|
-
c.flag '
|
13
|
+
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
14
|
+
c.flag 'team_id', desc: ''
|
15
|
+
c.flag 'enterprise_id', desc: ''
|
16
|
+
c.flag 'certified', desc: 'Limit the results to only include certified apps. When false, no certified apps will appear in the result.'
|
17
17
|
c.action do |_global_options, options, _args|
|
18
18
|
puts JSON.dump(@client.admin_apps_restricted_list(options))
|
19
19
|
end
|
@@ -6,19 +6,19 @@ module Slack
|
|
6
6
|
class App
|
7
7
|
desc 'AdminAuditAnomalyAllow methods.'
|
8
8
|
command 'admin_audit_anomaly_allow' do |g|
|
9
|
-
g.desc 'API to allow
|
10
|
-
g.long_desc %( API to allow
|
9
|
+
g.desc 'API to allow Enterprise org admins to read the allow list of IP blocks and ASNs from the enterprise configuration.'
|
10
|
+
g.long_desc %( API to allow Enterprise org admins to read the allow list of IP blocks and ASNs from the enterprise configuration. )
|
11
11
|
g.command 'getItem' do |c|
|
12
12
|
c.action do |_global_options, options, _args|
|
13
13
|
puts JSON.dump(@client.admin_audit_anomaly_allow_getItem(options))
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
g.desc 'API to allow
|
18
|
-
g.long_desc %( API to allow
|
17
|
+
g.desc 'API to allow Enterprise org admins to write/overwrite the allow list of IP blocks and ASNs from the enterprise configuration.'
|
18
|
+
g.long_desc %( API to allow Enterprise org admins to write/overwrite the allow list of IP blocks and ASNs from the enterprise configuration. )
|
19
19
|
g.command 'updateItem' do |c|
|
20
|
-
c.flag '
|
21
|
-
c.flag '
|
20
|
+
c.flag 'trusted_cidr', desc: 'allow list of IPv4 addresses using cidr notation in the Enterprise organization configuration.'
|
21
|
+
c.flag 'trusted_asns', desc: 'allow list of Autonomous System Numbers (ASN) in the Enterprise organization configuration.'
|
22
22
|
c.action do |_global_options, options, _args|
|
23
23
|
puts JSON.dump(@client.admin_audit_anomaly_allow_updateItem(options))
|
24
24
|
end
|
@@ -9,9 +9,9 @@ module Slack
|
|
9
9
|
g.desc 'Assign entities to a particular authentication policy.'
|
10
10
|
g.long_desc %( Assign entities to a particular authentication policy. )
|
11
11
|
g.command 'assignEntities' do |c|
|
12
|
-
c.flag 'entity_ids', desc: 'Array of IDs to assign to the policy.'
|
13
|
-
c.flag 'entity_type', desc: 'The type of entity to assign to the policy. Currently, USER is supported.'
|
14
12
|
c.flag 'policy_name', desc: 'The name of the authentication policy to assign the entities to. Currently, email_password is the only policy that may be used with this method.'
|
13
|
+
c.flag 'entity_type', desc: 'The type of entity to assign to the policy. Currently, USER is supported.'
|
14
|
+
c.flag 'entity_ids', desc: 'Array of IDs to assign to the policy.'
|
15
15
|
c.action do |_global_options, options, _args|
|
16
16
|
puts JSON.dump(@client.admin_auth_policy_assignEntities(options))
|
17
17
|
end
|
@@ -21,9 +21,9 @@ module Slack
|
|
21
21
|
g.long_desc %( Fetch all the entities assigned to a particular authentication policy by name. )
|
22
22
|
g.command 'getEntities' do |c|
|
23
23
|
c.flag 'policy_name', desc: 'The name of the policy to fetch entities for. Currently, email_password is the only policy that may be used with this method.'
|
24
|
-
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
25
24
|
c.flag 'entity_type', desc: 'The type of entity to assign to the policy. Currently, USER is supported.'
|
26
25
|
c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 and 1000, both inclusive.'
|
26
|
+
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
27
27
|
c.action do |_global_options, options, _args|
|
28
28
|
puts JSON.dump(@client.admin_auth_policy_getEntities(options))
|
29
29
|
end
|
@@ -32,9 +32,9 @@ module Slack
|
|
32
32
|
g.desc 'Remove specified entities from a specified authentication policy.'
|
33
33
|
g.long_desc %( Remove specified entities from a specified authentication policy. )
|
34
34
|
g.command 'removeEntities' do |c|
|
35
|
-
c.flag 'entity_ids', desc: "Encoded IDs of the entities you'd like to remove from the policy."
|
36
|
-
c.flag 'entity_type', desc: 'The type of entity to assign to the policy. Currently, USER is supported.'
|
37
35
|
c.flag 'policy_name', desc: 'The name of the policy to remove entities from. Currently, email_password is the only policy that may be used with this method.'
|
36
|
+
c.flag 'entity_type', desc: 'The type of entity to assign to the policy. Currently, USER is supported.'
|
37
|
+
c.flag 'entity_ids', desc: "Encoded IDs of the entities you'd like to remove from the policy."
|
38
38
|
c.action do |_global_options, options, _args|
|
39
39
|
puts JSON.dump(@client.admin_auth_policy_removeEntities(options))
|
40
40
|
end
|
@@ -9,8 +9,8 @@ module Slack
|
|
9
9
|
g.desc 'Create an Information Barrier'
|
10
10
|
g.long_desc %( Create an Information Barrier )
|
11
11
|
g.command 'create' do |c|
|
12
|
-
c.flag 'barriered_from_usergroup_ids', desc: 'A list of IDP Groups ids that the primary usergroup is to be barriered from.'
|
13
12
|
c.flag 'primary_usergroup_id', desc: 'The id of the primary IDP Group.'
|
13
|
+
c.flag 'barriered_from_usergroup_ids', desc: 'A list of IDP Groups ids that the primary usergroup is to be barriered from.'
|
14
14
|
c.flag 'restricted_subjects', desc: 'What kind of interactions are blocked by this barrier? For v1, we only support a list of all 3, eg im, mpim, call.'
|
15
15
|
c.action do |_global_options, options, _args|
|
16
16
|
puts JSON.dump(@client.admin_barriers_create(options))
|
@@ -29,8 +29,8 @@ module Slack
|
|
29
29
|
g.desc 'Get all Information Barriers for your organization'
|
30
30
|
g.long_desc %( Get all Information Barriers for your organization )
|
31
31
|
g.command 'list' do |c|
|
32
|
-
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
33
32
|
c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
|
33
|
+
c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
|
34
34
|
c.action do |_global_options, options, _args|
|
35
35
|
puts JSON.dump(@client.admin_barriers_list(options))
|
36
36
|
end
|
@@ -40,8 +40,8 @@ module Slack
|
|
40
40
|
g.long_desc %( Update an existing Information Barrier )
|
41
41
|
g.command 'update' do |c|
|
42
42
|
c.flag 'barrier_id', desc: "The ID of the barrier you're trying to modify."
|
43
|
-
c.flag 'barriered_from_usergroup_ids', desc: 'A list of IDP Groups ids that the primary usergroup is to be barriered from.'
|
44
43
|
c.flag 'primary_usergroup_id', desc: 'The id of the primary IDP Group.'
|
44
|
+
c.flag 'barriered_from_usergroup_ids', desc: 'A list of IDP Groups ids that the primary usergroup is to be barriered from.'
|
45
45
|
c.flag 'restricted_subjects', desc: 'What kind of interactions are blocked by this barrier? For v1, we only support a list of all 3, eg im, mpim, call.'
|
46
46
|
c.action do |_global_options, options, _args|
|
47
47
|
puts JSON.dump(@client.admin_barriers_update(options))
|