slack-ruby-client 3.3.0 → 3.4.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/danger-comment.yml +11 -2
- data/.github/workflows/danger.yml +10 -2
- data/.github/workflows/lint.yml +21 -8
- data/.github/workflows/release.yml +27 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +93 -1
- data/.spellcheck.txt +256 -0
- data/AGENTS.md +1 -1
- data/CHANGELOG.md +17 -0
- data/CONTRIBUTING.md +53 -62
- data/Gemfile +20 -4
- data/LICENSE.md +1 -1
- data/README.md +94 -104
- data/RELEASING.md +20 -58
- data/Rakefile +22 -0
- data/SECURITY.md +1 -1
- data/UPGRADING.md +39 -43
- data/benchmarks/events.rb +26 -0
- data/benchmarks/formatting.rb +17 -0
- data/benchmarks/support.rb +67 -0
- data/benchmarks/web_client.rb +28 -0
- data/bin/commands/admin_analytics_members.rb +39 -0
- data/bin/commands/admin_analytics_messages.rb +2 -2
- data/bin/commands/admin_analytics_slackbot.rb +33 -0
- data/bin/commands/admin_apps_permissions.rb +1 -1
- data/bin/commands/admin_conversations.rb +11 -1
- data/bin/commands/admin_slackbot_skills.rb +56 -0
- data/bin/commands/admin_users.rb +11 -2
- data/bin/commands/admin_users_access.rb +31 -0
- data/bin/commands/agents_conversations.rb +122 -0
- data/bin/commands/apps_managed_permissions.rb +2 -2
- data/bin/commands/chat.rb +1 -1
- data/bin/commands/pins.rb +1 -1
- data/bin/commands/slackLists_download.rb +1 -0
- data/bin/commands/slackLists_items.rb +1 -1
- data/bin/commands/slackbot_skills.rb +71 -0
- data/bin/commands/slackbot_skills_library.rb +29 -0
- data/bin/commands/team.rb +1 -0
- data/bin/commands/team_externalTeams.rb +1 -1
- data/examples/files_upload_v2/README.md +4 -3
- data/examples/oauth_v2/README.md +5 -4
- data/lib/slack/messages/formatting.rb +29 -20
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics_members.rb +66 -0
- data/lib/slack/web/api/endpoints/admin_analytics_messages.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics_slackbot.rb +54 -0
- data/lib/slack/web/api/endpoints/admin_apps_permissions.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_conversations.rb +16 -1
- data/lib/slack/web/api/endpoints/admin_slackbot_skills.rb +84 -0
- data/lib/slack/web/api/endpoints/admin_users.rb +13 -1
- data/lib/slack/web/api/endpoints/admin_users_access.rb +40 -0
- data/lib/slack/web/api/endpoints/agents_conversations.rb +186 -0
- data/lib/slack/web/api/endpoints/apps_managed_permissions.rb +1 -1
- data/lib/slack/web/api/endpoints/chat.rb +1 -1
- data/lib/slack/web/api/endpoints/pins.rb +1 -1
- data/lib/slack/web/api/endpoints/slackLists_download.rb +2 -0
- data/lib/slack/web/api/endpoints/slackLists_items.rb +1 -1
- data/lib/slack/web/api/endpoints/slackbot_skills.rb +107 -0
- data/lib/slack/web/api/endpoints/slackbot_skills_library.rb +36 -0
- data/lib/slack/web/api/endpoints/team.rb +2 -0
- data/lib/slack/web/api/endpoints/team_externalTeams.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +14 -0
- data/lib/slack/web/api/errors.rb +258 -2
- data/lib/slack/web/api/mixins/ids.id.rb +2 -1
- data/script/release.rb +33 -0
- data/slack-ruby-client.gemspec +1 -2
- metadata +24 -3
|
@@ -0,0 +1,122 @@
|
|
|
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 'AgentsConversations methods.'
|
|
8
|
+
command 'agents_conversations' do |g|
|
|
9
|
+
g.desc 'Archive a code channel.'
|
|
10
|
+
g.long_desc %( Archive a code channel. )
|
|
11
|
+
g.command 'archive' do |c|
|
|
12
|
+
c.flag 'channel_id', desc: 'ID of the code channel to archive.'
|
|
13
|
+
c.flag 'summary_message_ts', desc: 'Timestamp of a message in the code channel to share back as a thread reply on the origin message. Requires the channel to have an origin_link set.'
|
|
14
|
+
c.action do |_global_options, options, _args|
|
|
15
|
+
puts JSON.dump(@client.agents_conversations_archive(options))
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
g.desc 'Create a dedicated code channel for an agent session.'
|
|
20
|
+
g.long_desc %( Create a dedicated code channel for an agent session. )
|
|
21
|
+
g.command 'create' do |c|
|
|
22
|
+
c.flag 'team_id', desc: 'Encoded team id to create the channel in. Required for org tokens when origin_channel_id is not provided. When omitted, the workspace is derived from the origin channel.'
|
|
23
|
+
c.flag 'session_id', desc: 'An opaque identifier for the agent session. When provided, the call is idempotent: if a channel already exists for this session_id, it is returned instead of creating a new one.'
|
|
24
|
+
c.flag 'name', desc: 'A friendly display name for the code channel. Optional when origin_channel_id and origin_message_ts are provided — in that case the channel is named from the origin message and re-titled automatically. Required when no origin link is given.'
|
|
25
|
+
c.flag 'is_private', desc: "Whether the code channel is private. When omitted, the channel matches the privacy of origin_channel_id, or is public if no origin is given. An explicit value is always honored, even if it differs from the origin channel's privacy: passing false creates a public channel from a private origin."
|
|
26
|
+
c.flag 'origin_channel_id', desc: 'The channel ID where the agent session was initiated from. Must be provided together with origin_message_ts. The channel must be accessible to the calling user and must not be externally shared (Slack Connect). When team_id is omitted with an org token, the channel is created in the same workspace as this origin channel.'
|
|
27
|
+
c.flag 'origin_message_ts', desc: 'The message timestamp in the origin channel that started the agent session. Must be provided together with origin_channel_id. The author of this message is automatically invited to the newly created code channel.'
|
|
28
|
+
c.action do |_global_options, options, _args|
|
|
29
|
+
puts JSON.dump(@client.agents_conversations_create(options))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
g.desc 'Fetch a canvas attached to a code channel.'
|
|
34
|
+
g.long_desc %( Fetch a canvas attached to a code channel. )
|
|
35
|
+
g.command 'getCanvas' do |c|
|
|
36
|
+
c.flag 'channel', desc: 'ID of the agent session channel the canvas belongs to.'
|
|
37
|
+
c.flag 'canvas_id', desc: 'Encoded ID of the canvas to fetch.'
|
|
38
|
+
c.flag 'content_format', desc: 'Format to render the canvas content in. Defaults to markdown.'
|
|
39
|
+
c.flag 'include_resolved', desc: 'Whether to include resolved comment threads in the response. Defaults to false.'
|
|
40
|
+
c.action do |_global_options, options, _args|
|
|
41
|
+
puts JSON.dump(@client.agents_conversations_getCanvas(options))
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
g.desc 'List the views currently attached to a code channel.'
|
|
46
|
+
g.long_desc %( List the views currently attached to a code channel. )
|
|
47
|
+
g.command 'listViews' do |c|
|
|
48
|
+
c.flag 'channel_id', desc: 'ID of the code channel to list views for.'
|
|
49
|
+
c.action do |_global_options, options, _args|
|
|
50
|
+
puts JSON.dump(@client.agents_conversations_listViews(options))
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
g.desc 'Remove a view from a code channel.'
|
|
55
|
+
g.long_desc %( Remove a view from a code channel. )
|
|
56
|
+
g.command 'removeView' do |c|
|
|
57
|
+
c.flag 'channel_id', desc: 'ID of the code channel to remove the view from.'
|
|
58
|
+
c.flag 'view_key', desc: 'Agent-assigned key of the view to remove. Provide exactly one of view_key or view_id.'
|
|
59
|
+
c.flag 'view_id', desc: 'Encoded channel tab ID of the view to remove. Provide exactly one of view_key or view_id.'
|
|
60
|
+
c.action do |_global_options, options, _args|
|
|
61
|
+
puts JSON.dump(@client.agents_conversations_removeView(options))
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
g.desc 'Replace the full markdown content of a plan canvas attached to a code channel.'
|
|
66
|
+
g.long_desc %( Replace the full markdown content of a plan canvas attached to a code channel. )
|
|
67
|
+
g.command 'setCanvasContent' do |c|
|
|
68
|
+
c.flag 'channel', desc: 'ID of the agent session channel the canvas is attached to.'
|
|
69
|
+
c.flag 'canvas_id', desc: 'Encoded ID of the canvas whose content to replace.'
|
|
70
|
+
c.flag 'content', desc: 'The full new canvas content as markdown. The server diffs this against the current content and applies only the changed sections.'
|
|
71
|
+
c.action do |_global_options, options, _args|
|
|
72
|
+
puts JSON.dump(@client.agents_conversations_setCanvasContent(options))
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
g.desc 'Register the set of agent-defined slash commands for the calling agent in a code channel.'
|
|
77
|
+
g.long_desc %( Register the set of agent-defined slash commands for the calling agent in a code channel. )
|
|
78
|
+
g.command 'setCommands' do |c|
|
|
79
|
+
c.flag 'channel_id', desc: 'ID of the code channel to register commands for.'
|
|
80
|
+
c.flag 'commands', desc: "Full set of commands to register for the calling agent in this channel, replacing that agent's previously registered set. Pass an empty array to clear the agent's commands. At most 10 commands may exist across all agents in the channel; names must be unique within the set and must not collide with builtin Slack commands."
|
|
81
|
+
c.action do |_global_options, options, _args|
|
|
82
|
+
puts JSON.dump(@client.agents_conversations_setCommands(options))
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
g.desc 'Set properties on a code channel.'
|
|
87
|
+
g.long_desc %( Set properties on a code channel. )
|
|
88
|
+
g.command 'setProperties' do |c|
|
|
89
|
+
c.flag 'channel_id', desc: 'ID of the code channel to update.'
|
|
90
|
+
c.flag 'title', desc: 'New display title for the agent session.'
|
|
91
|
+
c.flag 'status', desc: 'New status for the agent session.'
|
|
92
|
+
c.flag 'code_channel', desc: 'Code channel properties to set. Only provided fields are updated.'
|
|
93
|
+
c.flag 'agent_resource', desc: 'Agent resource properties to set. Only provided fields are updated.'
|
|
94
|
+
c.action do |_global_options, options, _args|
|
|
95
|
+
puts JSON.dump(@client.agents_conversations_setProperties(options))
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
g.desc 'Create or update a view in a code channel.'
|
|
100
|
+
g.long_desc %( Create or update a view in a code channel. )
|
|
101
|
+
g.command 'setView' do |c|
|
|
102
|
+
c.flag 'channel_id', desc: 'ID of the code channel to render the view in.'
|
|
103
|
+
c.flag 'type', desc: 'The kind of view to create or update. Defaults to html. Determines which other arguments are required: html and diff require content, block_kit requires blocks, and canvas requires canvas_id.'
|
|
104
|
+
c.flag 'view_key', desc: "Agent-assigned stable identity for the view (e.g. the source file path on the agent's machine). Used as the upsert key: calls with the same view_key update the same view. Required for html, block_kit, and canvas views; ignored for diff (a diff view is a per-channel singleton)."
|
|
105
|
+
c.flag 'content', desc: 'View content. For html, a full self-contained HTML document; for diff, raw unified diff text. Capped at 1,000,000 bytes; larger content returns content_too_large. The cap is enforced by the handler (not schema maxLength) so the documented error code actually surfaces instead of a generic argument-validation failure. Required when type is html or diff.'
|
|
106
|
+
c.flag 'blocks', desc: 'Block Kit blocks to render in the view tab. Required when type is block_kit; ignored otherwise.'
|
|
107
|
+
c.flag 'canvas_id', desc: 'Encoded ID of the canvas to attach as the view. Required when type is canvas; ignored otherwise.'
|
|
108
|
+
c.flag 'access_level', desc: 'For canvas views: access level granted to the channel for the canvas tab. Defaults to write. Use comment to grant channel members comment access (read and comment, no editing) so the agent remains the sole author of the canvas text.'
|
|
109
|
+
c.flag 'agent_content_hash', desc: 'For canvas views: hash of the canvas-derived markdown the agent last wrote, recorded so the agent can later detect human edits to the canvas. Opaque to the server.'
|
|
110
|
+
c.flag 'base_branch', desc: 'For diff views: base branch name for display purposes.'
|
|
111
|
+
c.flag 'head_branch', desc: 'For diff views: head branch name for display purposes.'
|
|
112
|
+
c.flag 'name', desc: 'Display label for the view tab. Preferred over the legacy label argument (name wins if both are supplied). Defaults to the last path segment of view_key, stripped of any .html or .htm extension.'
|
|
113
|
+
c.flag 'label', desc: 'Deprecated alias for name. Display label for the view tab. Defaults to the last path segment of view_key, stripped of any .html or .htm extension.'
|
|
114
|
+
c.flag 'csp', desc: 'Content-Security-Policy domain declarations for the view. Domains are validated server-side (https:// only, no private or internal hosts) and persisted.'
|
|
115
|
+
c.action do |_global_options, options, _args|
|
|
116
|
+
puts JSON.dump(@client.agents_conversations_setView(options))
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -6,8 +6,8 @@ module Slack
|
|
|
6
6
|
class App
|
|
7
7
|
desc 'AppsManagedPermissions methods.'
|
|
8
8
|
command 'apps_managed_permissions' do |g|
|
|
9
|
-
g.desc "Set who can interact with a managed app. Lets the builder who created a managed app on a partner platform configure the app's permissions
|
|
10
|
-
g.long_desc %( Set who can interact with a managed app. Lets the builder who created a managed app on a partner platform configure the app's permissions
|
|
9
|
+
g.desc "Set who can interact with a managed app. Lets the builder who created a managed app on a partner platform configure the app's permissions, using a user token or bot token from the manager app. Permissions can only be set before the app is installed: if the app is already installed, this method makes no change and returns the app's current permissions."
|
|
10
|
+
g.long_desc %( Set who can interact with a managed app. Lets the builder who created a managed app on a partner platform configure the app's permissions, using a user token or bot token from the manager app. Permissions can only be set before the app is installed: if the app is already installed, this method makes no change and returns the app's current permissions. )
|
|
11
11
|
g.command 'set' do |c|
|
|
12
12
|
c.flag 'app_id', desc: 'Encoded ID of the managed app to configure.'
|
|
13
13
|
c.flag 'permissions', desc: "Who can interact with the app. Use everyone to allow all members, or app_owner to restrict access to the app's owner."
|
data/bin/commands/chat.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Slack
|
|
|
10
10
|
g.long_desc %( Appends text to an existing streaming conversation. )
|
|
11
11
|
g.command 'appendStream' do |c|
|
|
12
12
|
c.flag 'channel', desc: 'An encoded ID that represents a channel, private group, or DM.'
|
|
13
|
-
c.flag 'chunks', desc: 'Array of streaming chunks.'
|
|
13
|
+
c.flag 'chunks', desc: 'Array of streaming chunks that can contain either markdown text or task updates.'
|
|
14
14
|
c.flag 'ts', desc: 'The timestamp of the streaming message.'
|
|
15
15
|
c.flag 'markdown_text', desc: 'Accepts message text formatted in markdown. Limit this field to 12,000 characters. This text is what will be appended to the message received so far.'
|
|
16
16
|
c.action do |_global_options, options, _args|
|
data/bin/commands/pins.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Slack
|
|
|
9
9
|
g.desc 'Pins an item to a channel.'
|
|
10
10
|
g.long_desc %( Pins an item to a channel. )
|
|
11
11
|
g.command 'add' do |c|
|
|
12
|
-
c.flag 'channel', desc: 'Channel to pin the
|
|
12
|
+
c.flag 'channel', desc: 'Channel to pin the message to. You must also include a timestamp when pinning messages.'
|
|
13
13
|
c.flag 'timestamp', desc: 'Timestamp of the message to pin. You must also include the channel.'
|
|
14
14
|
c.action do |_global_options, options, _args|
|
|
15
15
|
puts JSON.dump(@client.pins_add(options))
|
|
@@ -14,6 +14,7 @@ module Slack
|
|
|
14
14
|
c.flag 'format', desc: 'Format the export was started with. Must match the format passed to slackLists.download.start. Defaults to csv.'
|
|
15
15
|
c.flag 'include_threads', desc: 'Must match the include_threads passed to slackLists.download.start. The returned download_url carries this through so the served export matches what was generated. Only applies when format is json.'
|
|
16
16
|
c.flag 'include_attachments', desc: 'Must match the include_attachments passed to slackLists.download.start. The returned download_url carries this through so the served export matches what was generated. Only applies when format is json.'
|
|
17
|
+
c.flag 'include_archived', desc: 'Must match the include_archived passed to slackLists.download.start. The returned download_url carries this through so the served export includes archived items when they were requested.'
|
|
17
18
|
c.action do |_global_options, options, _args|
|
|
18
19
|
puts JSON.dump(@client.slackLists_download_get(options))
|
|
19
20
|
end
|
|
@@ -53,7 +53,7 @@ module Slack
|
|
|
53
53
|
g.long_desc %( Get records from a List. )
|
|
54
54
|
g.command 'list' do |c|
|
|
55
55
|
c.flag 'list_id', desc: 'ID of the List.'
|
|
56
|
-
c.flag 'limit', desc: 'The maximum number of records to return.'
|
|
56
|
+
c.flag 'limit', desc: 'The maximum number of records to return, up to the list row limit of 5000.'
|
|
57
57
|
c.flag 'cursor', desc: 'Next cursor for pagination.'
|
|
58
58
|
c.flag 'archived', desc: 'Boolean indicating whether archived items or normal items should be returned.'
|
|
59
59
|
c.flag 'include_list', desc: 'Set to true to also return the parent list object, including its title, column schema, and total row count. Defaults to false to keep the response small.'
|
|
@@ -0,0 +1,71 @@
|
|
|
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 'SlackbotSkills methods.'
|
|
8
|
+
command 'slackbot_skills' do |g|
|
|
9
|
+
g.desc 'Creates a skill from markdown instructions, or turns an existing canvas the caller owns into a skill.'
|
|
10
|
+
g.long_desc %( Creates a skill from markdown instructions, or turns an existing canvas the caller owns into a skill. )
|
|
11
|
+
g.command 'create' do |c|
|
|
12
|
+
c.flag 'display_name', desc: 'Human-readable label. Max 255 characters; not unique.'
|
|
13
|
+
c.flag 'instructions', desc: 'Markdown body of the skill. Send exactly one of instructions or canvas_id.'
|
|
14
|
+
c.flag 'canvas_id', desc: 'Canvas the caller owns to turn into a skill. Send exactly one of instructions or canvas_id.'
|
|
15
|
+
c.flag 'description', desc: 'When Slackbot should use the skill. Max 400 characters.'
|
|
16
|
+
c.flag 'category', desc: 'One of the skill categories.'
|
|
17
|
+
c.flag 'example_prompt', desc: 'Max 200 characters. May contain {skill}, which becomes the skill mention.'
|
|
18
|
+
c.flag 'mcp_servers', desc: "Apps the skill needs, capped at the caller's MCP server limit. Declaring an app doesn't grant access to it."
|
|
19
|
+
c.action do |_global_options, options, _args|
|
|
20
|
+
puts JSON.dump(@client.slackbot_skills_create(options))
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
g.desc 'Deletes a Slackbot skill and its canvas, and removes it from every library, skill set, and the org catalog.'
|
|
25
|
+
g.long_desc %( Deletes a Slackbot skill and its canvas, and removes it from every library, skill set, and the org catalog. )
|
|
26
|
+
g.command 'delete' do |c|
|
|
27
|
+
c.flag 'skill_id', desc: 'Skill to delete.'
|
|
28
|
+
c.action do |_global_options, options, _args|
|
|
29
|
+
puts JSON.dump(@client.slackbot_skills_delete(options))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
g.desc 'Returns one Slackbot skill, including its instructions.'
|
|
34
|
+
g.long_desc %( Returns one Slackbot skill, including its instructions. )
|
|
35
|
+
g.command 'info' do |c|
|
|
36
|
+
c.flag 'skill_id', desc: 'Skill to fetch: a canvas file ID or a builtin: reference.'
|
|
37
|
+
c.action do |_global_options, options, _args|
|
|
38
|
+
puts JSON.dump(@client.slackbot_skills_info(options))
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
g.desc "Lists Slackbot skills from the caller's point of view. Instructions are not included."
|
|
43
|
+
g.long_desc %( Lists Slackbot skills from the caller's point of view. Instructions are not included. )
|
|
44
|
+
g.command 'list' do |c|
|
|
45
|
+
c.flag 'filter', desc: "library: skills enabled for the caller, including auto-enabled skills and skills from skill sets. owned: skills the caller created. catalog: the organization's official skills."
|
|
46
|
+
c.flag 'category', desc: 'Only return skills in this category.'
|
|
47
|
+
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. Must be used with the same filter and category."
|
|
48
|
+
c.flag 'limit', desc: 'The maximum number of skills to return. Fewer may be returned even when more remain.'
|
|
49
|
+
c.action do |_global_options, options, _args|
|
|
50
|
+
puts JSON.dump(@client.slackbot_skills_list(options))
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
g.desc "Changes a Slackbot skill's instructions or metadata. Only the inputs you send are changed; a call that changes nothing succeeds without writing."
|
|
55
|
+
g.long_desc %( Changes a Slackbot skill's instructions or metadata. Only the inputs you send are changed; a call that changes nothing succeeds without writing. )
|
|
56
|
+
g.command 'update' do |c|
|
|
57
|
+
c.flag 'skill_id', desc: 'Skill to change.'
|
|
58
|
+
c.flag 'display_name', desc: 'Human-readable label. Max 255 characters.'
|
|
59
|
+
c.flag 'instructions', desc: 'Markdown that replaces the whole document.'
|
|
60
|
+
c.flag 'description', desc: 'When Slackbot should use the skill. Max 400 characters. Send an empty string to clear.'
|
|
61
|
+
c.flag 'category', desc: 'One of the skill categories. Send an empty string to clear.'
|
|
62
|
+
c.flag 'example_prompt', desc: 'Max 200 characters. May contain {skill}. Send an empty string to clear.'
|
|
63
|
+
c.flag 'mcp_servers', desc: 'Apps the skill needs. Replaces the whole list; send [] to clear.'
|
|
64
|
+
c.action do |_global_options, options, _args|
|
|
65
|
+
puts JSON.dump(@client.slackbot_skills_update(options))
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
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 'SlackbotSkillsLibrary methods.'
|
|
8
|
+
command 'slackbot_skills_library' do |g|
|
|
9
|
+
g.desc "Turns a skill on in the caller's personal library."
|
|
10
|
+
g.long_desc %( Turns a skill on in the caller's personal library. )
|
|
11
|
+
g.command 'add' do |c|
|
|
12
|
+
c.flag 'skill_id', desc: 'Skill to turn on for the caller.'
|
|
13
|
+
c.action do |_global_options, options, _args|
|
|
14
|
+
puts JSON.dump(@client.slackbot_skills_library_add(options))
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
g.desc "Turns a skill off in the caller's personal library."
|
|
19
|
+
g.long_desc %( Turns a skill off in the caller's personal library. )
|
|
20
|
+
g.command 'remove' do |c|
|
|
21
|
+
c.flag 'skill_id', desc: 'Skill to turn off for the caller.'
|
|
22
|
+
c.action do |_global_options, options, _args|
|
|
23
|
+
puts JSON.dump(@client.slackbot_skills_library_remove(options))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/bin/commands/team.rb
CHANGED
|
@@ -35,6 +35,7 @@ module Slack
|
|
|
35
35
|
g.command 'info' do |c|
|
|
36
36
|
c.flag 'domain', desc: "Query by domain instead of team (only when team is null). This only works for domains in the same enterprise as the querying team token. This also expects the domain to belong to a team and not the enterprise itself. This is the value set up for the 'Joining This Workspace' workspace setting. If it contains more than one domain, the field will contain multiple comma-separated domain values. If no domain is set, the field is empty."
|
|
37
37
|
c.flag 'team', desc: 'Team to get info about; if omitted, will return information about the current team.'
|
|
38
|
+
c.flag 'include_slackbot_availability', desc: "Include advisory Slackbot availability for the returned workspace or organization. Only applies to a single team in the caller's own workspace or organization; omitted for external teams. Does not guarantee individual eligibility, remaining usage, or access to a particular app."
|
|
38
39
|
c.action do |_global_options, options, _args|
|
|
39
40
|
puts JSON.dump(@client.team_info(options))
|
|
40
41
|
end
|
|
@@ -22,7 +22,7 @@ module Slack
|
|
|
22
22
|
c.flag 'cursor', desc: "Paginate through collections of data by setting parameter to the team_id attribute returned by a previous request's response_metadata. If not provided, the first page of the collection is returned. See pagination for more detail."
|
|
23
23
|
c.flag 'sort_field', desc: 'Name of the parameter that we are sorting by.'
|
|
24
24
|
c.flag 'sort_direction', desc: 'Direction to sort in asc or desc.'
|
|
25
|
-
c.flag 'slack_connect_pref_filter', desc: 'Filters connected orgs by Slack Connect pref override(s). Value can be: approved_orgs_only allow_sc_file_uploads profile_visibility away_team_sc_invite_permissions accept_sc_invites sc_mpdm_to_private
|
|
25
|
+
c.flag 'slack_connect_pref_filter', desc: 'Filters connected orgs by Slack Connect pref override(s). Value can be: approved_orgs_only allow_sc_file_uploads profile_visibility away_team_sc_invite_permissions accept_sc_invites sc_mpdm_to_private external_awareness_context_bar.'
|
|
26
26
|
c.flag 'workspace_filter', desc: 'Shows connected orgs which are connected on a specified encoded workspace ID.'
|
|
27
27
|
c.flag 'connection_status_filter', desc: 'Status of the connected team.'
|
|
28
28
|
c.action do |_global_options, options, _args|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
# Files Upload V2 Example
|
|
2
|
+
|
|
1
3
|
Samples for using `files_upload_v2`.
|
|
2
4
|
|
|
3
5
|
## Usage
|
|
4
6
|
|
|
5
|
-
Create a Slack app and obtain a User OAuth Token
|
|
6
|
-
Make sure to select `files:write` and `files:read` scopes under "User Token Scopes".
|
|
7
|
+
Create a Slack app and [obtain a User OAuth Token](https://docs.slack.dev/authentication/tokens/) or use the [oauth_v2](../oauth_v2) example to obtain a User OAuth Token. Make sure to select `files:write` and `files:read` scopes under "User Token Scopes".
|
|
7
8
|
|
|
8
9
|
Create `.env` file with `SLACK_API_TOKEN` or set the `SLACK_API_TOKEN` environment variable.
|
|
9
10
|
|
|
10
|
-
```
|
|
11
|
+
```bash
|
|
11
12
|
bundle install
|
|
12
13
|
bundle exec dotenv ruby files_upload_v2.rb
|
|
13
14
|
```
|
data/examples/oauth_v2/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
# OAuth V2 Example
|
|
2
|
+
|
|
1
3
|
Obtain a user OAuth token from Slack.
|
|
2
4
|
|
|
3
|
-
Create a Slack app
|
|
5
|
+
[Create a Slack app](https://api.slack.com/apps).
|
|
4
6
|
|
|
5
|
-
The new app has a pre-configured User OAuth Token which you can use for most of the examples.
|
|
6
|
-
However you may want to obtain a token for a different user, which can be accomplished as follows.
|
|
7
|
+
The new app has a pre-configured User OAuth Token which you can use for most of the examples. However you may want to obtain a token for a different user, which can be accomplished as follows.
|
|
7
8
|
|
|
8
9
|
To test locally use [ngrok](https://ngrok.com/) to expose your local server to the internet.
|
|
9
10
|
|
|
@@ -15,7 +16,7 @@ Add the ngrok URL to the app's "Redirect URLs" under "OAuth & Permissions" in th
|
|
|
15
16
|
|
|
16
17
|
Create a `.env` file with the following:
|
|
17
18
|
|
|
18
|
-
```
|
|
19
|
+
```dotenv
|
|
19
20
|
SLACK_CLIENT_ID=[App Client ID]
|
|
20
21
|
SLACK_CLIENT_SECRET=[App Client Secret]
|
|
21
22
|
REDIRECT_URI=[Your ngrok URL, e.g. https://...ngrok-free.app]
|
|
@@ -8,21 +8,11 @@ module Slack
|
|
|
8
8
|
# @see https://api.slack.com/docs/formatting
|
|
9
9
|
#
|
|
10
10
|
def unescape(message)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.gsub(/<(?<sign>[?@#!]?)(?<dt>.*?)>/)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
rhs = dt.split('|', 2).last
|
|
17
|
-
case sign
|
|
18
|
-
when '@', '!'
|
|
19
|
-
"@#{rhs}"
|
|
20
|
-
when '#'
|
|
21
|
-
"##{rhs}"
|
|
22
|
-
else
|
|
23
|
-
rhs
|
|
24
|
-
end
|
|
25
|
-
end)
|
|
11
|
+
message = message.tr('“”‘’', %(""''))
|
|
12
|
+
if message.include?('<')
|
|
13
|
+
message = message.gsub(/<(?<sign>[?@#!]?)(?<dt>.*?)>/) { unescape_reference(Regexp.last_match) }
|
|
14
|
+
end
|
|
15
|
+
message.include?('&') ? CGI.unescapeHTML(message) : message
|
|
26
16
|
end
|
|
27
17
|
|
|
28
18
|
#
|
|
@@ -82,12 +72,31 @@ module Slack
|
|
|
82
72
|
# @see https://api.slack.com/reference/surfaces/formatting#basic-formatting
|
|
83
73
|
#
|
|
84
74
|
def markdown(text)
|
|
75
|
+
return text.dup unless text.include?('*') || text.include?('~~') || text.include?('](')
|
|
76
|
+
|
|
77
|
+
if text.include?('*')
|
|
78
|
+
text = text
|
|
79
|
+
.gsub(/(?<!\*)\*([^*\n]+)\*(?!\*)/, '_\1_') # italic
|
|
80
|
+
.gsub(/\*\*\*(.*?)\*\*\*/, '*_\1_*') # bold & italic
|
|
81
|
+
.gsub(/\*\*(.*?)\*\*/, '*\1*') # bold
|
|
82
|
+
end
|
|
83
|
+
text = text.gsub(/~~(.*?)~~/, '~\1~') if text.include?('~~') # strikethrough
|
|
84
|
+
text = text.gsub(/\[(.*?)\]\((.*?)\)/, '<\2|\1>') if text.include?('](') # links
|
|
85
85
|
text
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
private
|
|
89
|
+
|
|
90
|
+
def unescape_reference(match)
|
|
91
|
+
rhs = match[:dt].split('|', 2).last
|
|
92
|
+
case match[:sign]
|
|
93
|
+
when '@', '!'
|
|
94
|
+
"@#{rhs}"
|
|
95
|
+
when '#'
|
|
96
|
+
"##{rhs}"
|
|
97
|
+
else
|
|
98
|
+
rhs
|
|
99
|
+
end
|
|
91
100
|
end
|
|
92
101
|
end
|
|
93
102
|
end
|
data/lib/slack/version.rb
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
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 AdminAnalyticsMembers
|
|
9
|
+
#
|
|
10
|
+
# Retrieves activity metrics for each member of an organization or workspace for one day. Returns the same metrics as the member analytics dashboard, sorted by user ID.
|
|
11
|
+
#
|
|
12
|
+
# @option options [date] :date
|
|
13
|
+
# The day to report on, as YYYY-MM-DD in UTC. Each metric counts that day's activity. Defaults to the most recent day with data. The response's available_date_range gives the earliest and latest days you can request.
|
|
14
|
+
# @option options [string] :team_id
|
|
15
|
+
# Workspace ID to scope the results to. With an organization-level token, omit it for organization-wide results. A workspace-level token may only pass its own workspace.
|
|
16
|
+
# @option options [array] :member_types
|
|
17
|
+
# Comma-separated list of member types to include. Omit to include every member type.
|
|
18
|
+
# @option options [array] :user_ids
|
|
19
|
+
# Comma-separated list of user IDs to return. Use admin.analytics.members.metadata, which supports searching by name and email, to find them; this method never returns names or email addresses. Up to 500 IDs. Deactivated members may be included. Omit to return every member.
|
|
20
|
+
# @option options [string] :cursor
|
|
21
|
+
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection.
|
|
22
|
+
# @option options [integer] :limit
|
|
23
|
+
# Maximum number of members to return. Max allowed is 500.
|
|
24
|
+
# @see https://api.slack.com/methods/admin.analytics.members.activity
|
|
25
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.analytics.members/admin.analytics.members.activity.json
|
|
26
|
+
def admin_analytics_members_activity(options = {})
|
|
27
|
+
if block_given?
|
|
28
|
+
Pagination::Cursor.new(self, :admin_analytics_members_activity, options).each do |page|
|
|
29
|
+
yield page
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
post('admin.analytics.members.activity', options)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#
|
|
37
|
+
# Retrieves profile metadata for each member of an organization or workspace. Returns the same profile fields as the member analytics dashboard, sorted by user ID, as the companion of admin.analytics.members.activity.
|
|
38
|
+
#
|
|
39
|
+
# @option options [Object] :include_deactivated_since
|
|
40
|
+
# Also return members deactivated on or after this day, as YYYY-MM-DD in UTC. Without it, only active members are returned.
|
|
41
|
+
# @option options [string] :team_id
|
|
42
|
+
# Workspace ID to scope the results to. With an organization-level token, omit it for organization-wide results. A workspace-level token may only pass its own workspace.
|
|
43
|
+
# @option options [array] :member_types
|
|
44
|
+
# Comma-separated list of member types to include. Omit to include every member type.
|
|
45
|
+
# @option options [string] :query
|
|
46
|
+
# Space-delimited search terms matched against member names, and against email addresses when the organization shows them. When the organization hides email addresses, or hides guest email addresses, the search does not match on email at all, so a hidden address cannot be recovered by searching for it. Only matching members are returned.
|
|
47
|
+
# @option options [string] :cursor
|
|
48
|
+
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection.
|
|
49
|
+
# @option options [integer] :limit
|
|
50
|
+
# Maximum number of members to return. Max allowed is 500.
|
|
51
|
+
# @see https://api.slack.com/methods/admin.analytics.members.metadata
|
|
52
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.analytics.members/admin.analytics.members.metadata.json
|
|
53
|
+
def admin_analytics_members_metadata(options = {})
|
|
54
|
+
if block_given?
|
|
55
|
+
Pagination::Cursor.new(self, :admin_analytics_members_metadata, options).each do |page|
|
|
56
|
+
yield page
|
|
57
|
+
end
|
|
58
|
+
else
|
|
59
|
+
post('admin.analytics.members.metadata', options)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -7,7 +7,7 @@ module Slack
|
|
|
7
7
|
module Endpoints
|
|
8
8
|
module AdminAnalyticsMessages
|
|
9
9
|
#
|
|
10
|
-
# Retrieves activity metrics for messages from a given channel
|
|
10
|
+
# Retrieves activity metrics for messages from a given channel, created between oldest_ts and latest_ts
|
|
11
11
|
#
|
|
12
12
|
# @option options [channel] :channel
|
|
13
13
|
# Channel ID for channel of the message activity to query.
|
|
@@ -0,0 +1,54 @@
|
|
|
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 AdminAnalyticsSlackbot
|
|
9
|
+
#
|
|
10
|
+
# Retrieve per-user Slackbot skill usage for an Enterprise organization on a single date, returned as paginated JSON.
|
|
11
|
+
#
|
|
12
|
+
# @option options [date] :date
|
|
13
|
+
# The date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC. If not provided, defaults to the latest date with available data. The response's available_date_range gives the earliest and latest dates you can request.
|
|
14
|
+
# @option options [string] :cursor
|
|
15
|
+
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection.
|
|
16
|
+
# @option options [integer] :limit
|
|
17
|
+
# Maximum number of skill entries to return per page, counted across all rows. Defaults to 500. Max allowed is 1000.
|
|
18
|
+
# @see https://api.slack.com/methods/admin.analytics.slackbot.skills
|
|
19
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.analytics.slackbot/admin.analytics.slackbot.skills.json
|
|
20
|
+
def admin_analytics_slackbot_skills(options = {})
|
|
21
|
+
if block_given?
|
|
22
|
+
Pagination::Cursor.new(self, :admin_analytics_slackbot_skills, options).each do |page|
|
|
23
|
+
yield page
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
post('admin.analytics.slackbot.skills', options)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
#
|
|
31
|
+
# Retrieve per-user Slackbot tool usage for an Enterprise organization on a single date, returned as paginated JSON.
|
|
32
|
+
#
|
|
33
|
+
# @option options [date] :date
|
|
34
|
+
# The date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC. If not provided, defaults to the latest date with available data. The response's available_date_range gives the earliest and latest dates you can request.
|
|
35
|
+
# @option options [string] :cursor
|
|
36
|
+
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection.
|
|
37
|
+
# @option options [integer] :limit
|
|
38
|
+
# Maximum number of tool entries to return per page, counted across all rows. Defaults to 500. Max allowed is 1000.
|
|
39
|
+
# @see https://api.slack.com/methods/admin.analytics.slackbot.tools
|
|
40
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.analytics.slackbot/admin.analytics.slackbot.tools.json
|
|
41
|
+
def admin_analytics_slackbot_tools(options = {})
|
|
42
|
+
if block_given?
|
|
43
|
+
Pagination::Cursor.new(self, :admin_analytics_slackbot_tools, options).each do |page|
|
|
44
|
+
yield page
|
|
45
|
+
end
|
|
46
|
+
else
|
|
47
|
+
post('admin.analytics.slackbot.tools', options)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -64,7 +64,7 @@ module Slack
|
|
|
64
64
|
# @option options [array] :user_ids
|
|
65
65
|
# List of user IDs to allow for named_entities visibility.
|
|
66
66
|
# @option options [array] :usergroup_ids
|
|
67
|
-
# List of encoded usergroup IDs.
|
|
67
|
+
# List of encoded usergroup IDs the permission applies to. With named_entities the listed groups may access the app; with named_entities_exclude they may not.
|
|
68
68
|
# @option options [enum] :channel_restriction_mode
|
|
69
69
|
# The mode that defines where the app can be used in channels.
|
|
70
70
|
# @option options [array] :channel_ids
|
|
@@ -238,6 +238,21 @@ module Slack
|
|
|
238
238
|
post('admin.conversations.invite', options)
|
|
239
239
|
end
|
|
240
240
|
|
|
241
|
+
#
|
|
242
|
+
# Remove multiple users from a conversation. Admin version of conversations.kick with support for bulk user removal.
|
|
243
|
+
#
|
|
244
|
+
# @option options [Object] :channel_id
|
|
245
|
+
# ID of conversation to remove users from.
|
|
246
|
+
# @option options [array] :user_ids
|
|
247
|
+
# The users to remove from the channel.
|
|
248
|
+
# @see https://api.slack.com/methods/admin.conversations.kick
|
|
249
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.kick.json
|
|
250
|
+
def admin_conversations_kick(options = {})
|
|
251
|
+
raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
|
|
252
|
+
raise ArgumentError, 'Required arguments :user_ids missing' if options[:user_ids].nil?
|
|
253
|
+
post('admin.conversations.kick', options)
|
|
254
|
+
end
|
|
255
|
+
|
|
241
256
|
#
|
|
242
257
|
# Link a Salesforce record to a channel
|
|
243
258
|
#
|
|
@@ -318,7 +333,7 @@ module Slack
|
|
|
318
333
|
# @option options [array] :connected_team_ids
|
|
319
334
|
# Array of encoded team IDs, signifying the external orgs to search through.
|
|
320
335
|
# @option options [string] :query
|
|
321
|
-
# Name of the
|
|
336
|
+
# Name of the channel to query by.
|
|
322
337
|
# @option options [integer] :limit
|
|
323
338
|
# Maximum number of items to be returned. Must be between 1 - 20 both inclusive. Default is 10.
|
|
324
339
|
# @option options [string] :cursor
|