lex-slack 0.1.0 → 0.3.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/ci.yml +16 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +56 -0
- data/CHANGELOG.md +41 -0
- data/CLAUDE.md +89 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +88 -0
- data/LICENSE.txt +21 -0
- data/README.md +223 -0
- data/Rakefile +8 -0
- data/lex-slack.gemspec +29 -0
- data/lib/legion/extensions/slack/actors/message_poller.rb +79 -0
- data/lib/legion/extensions/slack/client.rb +51 -0
- data/lib/legion/extensions/slack/helpers/client.rb +30 -0
- data/lib/legion/extensions/slack/runners/blocks.rb +97 -0
- data/lib/legion/extensions/slack/runners/bookmarks.rb +46 -0
- data/lib/legion/extensions/slack/runners/chat.rb +63 -0
- data/lib/legion/extensions/slack/runners/conversations.rb +104 -0
- data/lib/legion/extensions/slack/runners/files.rb +57 -0
- data/lib/legion/extensions/slack/runners/pins.rb +33 -0
- data/lib/legion/extensions/slack/runners/reactions.rb +43 -0
- data/lib/legion/extensions/slack/runners/reminders.rb +47 -0
- data/lib/legion/extensions/slack/runners/search.rb +35 -0
- data/lib/legion/extensions/slack/runners/usergroups.rb +67 -0
- data/lib/legion/extensions/slack/runners/users.rb +48 -0
- data/lib/legion/extensions/slack/runners/views.rb +41 -0
- data/lib/legion/extensions/slack/version.rb +9 -0
- data/lib/legion/extensions/slack.rb +26 -0
- metadata +44 -101
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 792ea5ec2fb4bb3991a58b84a7ddd261cc6b8a8a89e0dd402e3e9eba9d9eeb4a
|
|
4
|
+
data.tar.gz: 7f95c2db6113a183bf6ed8568d3f0f22cf1670f538f104b41a04fb1caea98fda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f09185b9193cbf274f571983a44abb5540c8f404ca4e7327c5cdc266002710204460d71e78315ab6e3e03569fcedad76e06f0e6c178e6ce67b59490833190791
|
|
7
|
+
data.tar.gz: 15625764b7d0b206ea2a28f6427d0e634332765f9d817895b1b0a2a74991a64413a7e54f351a5d670350d58d50480ce3d31f7201cedb2bd54fbeade74d17111c
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
ci:
|
|
9
|
+
uses: LegionIO/.github/.github/workflows/ci.yml@main
|
|
10
|
+
|
|
11
|
+
release:
|
|
12
|
+
needs: ci
|
|
13
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
14
|
+
uses: LegionIO/.github/.github/workflows/release.yml@main
|
|
15
|
+
secrets:
|
|
16
|
+
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.4
|
|
3
|
+
NewCops: enable
|
|
4
|
+
SuggestExtensions: false
|
|
5
|
+
|
|
6
|
+
Layout/LineLength:
|
|
7
|
+
Max: 160
|
|
8
|
+
|
|
9
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
|
10
|
+
EnforcedStyle: space
|
|
11
|
+
|
|
12
|
+
Layout/HashAlignment:
|
|
13
|
+
EnforcedHashRocketStyle: table
|
|
14
|
+
EnforcedColonStyle: table
|
|
15
|
+
|
|
16
|
+
Metrics/MethodLength:
|
|
17
|
+
Max: 50
|
|
18
|
+
|
|
19
|
+
Metrics/ClassLength:
|
|
20
|
+
Max: 1500
|
|
21
|
+
|
|
22
|
+
Metrics/ModuleLength:
|
|
23
|
+
Max: 1500
|
|
24
|
+
|
|
25
|
+
Metrics/BlockLength:
|
|
26
|
+
Max: 200
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'spec/**/*'
|
|
29
|
+
|
|
30
|
+
Metrics/ParameterLists:
|
|
31
|
+
Max: 8
|
|
32
|
+
|
|
33
|
+
Naming/MethodParameterName:
|
|
34
|
+
MinNameLength: 2
|
|
35
|
+
|
|
36
|
+
Metrics/AbcSize:
|
|
37
|
+
Max: 60
|
|
38
|
+
|
|
39
|
+
Metrics/CyclomaticComplexity:
|
|
40
|
+
Max: 15
|
|
41
|
+
|
|
42
|
+
Metrics/PerceivedComplexity:
|
|
43
|
+
Max: 17
|
|
44
|
+
|
|
45
|
+
Style/Documentation:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
Style/SymbolArray:
|
|
49
|
+
Enabled: true
|
|
50
|
+
|
|
51
|
+
Style/FrozenStringLiteralComment:
|
|
52
|
+
Enabled: true
|
|
53
|
+
EnforcedStyle: always
|
|
54
|
+
|
|
55
|
+
Naming/FileName:
|
|
56
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.3.0] - 2026-03-20
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Named connection builders: `api_connection` (Slack Web API) and `webhook_connection` (incoming webhooks)
|
|
7
|
+
- Runners::Blocks - Block Kit builder (section, divider, header, actions, context, image, input, button, select, datepicker, etc.)
|
|
8
|
+
- Runners::Chat - post_message, send_webhook, update_message, delete_message, schedule_message, delete_scheduled
|
|
9
|
+
- Runners::Conversations - list, info, history, replies, members, join, leave, invite, open, create, archive, set_topic
|
|
10
|
+
- Runners::Users - list, info, lookup_by_email, get_presence, set_presence
|
|
11
|
+
- Runners::Reactions - add, remove, get, list
|
|
12
|
+
- Runners::Files - upload (two-step external), list, info, delete, share
|
|
13
|
+
- Runners::Pins - add, remove, list
|
|
14
|
+
- Runners::Bookmarks - add, edit, remove, list
|
|
15
|
+
- Runners::Reminders - add, complete, delete, info, list
|
|
16
|
+
- Runners::Usergroups - create, update, disable, enable, list, list_users, update_users
|
|
17
|
+
- Runners::Views - open, push, update, publish
|
|
18
|
+
- Runners::Search - search_messages, search_files
|
|
19
|
+
- Actor::MessagePoller - configurable channel polling with high-water mark tracking (disabled by default)
|
|
20
|
+
- Standalone Client including all runners with automatic credential injection
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- Complete rebuild from v0.2.0
|
|
24
|
+
- Dropped `multi_json` dependency (unused)
|
|
25
|
+
- Renamed `Runners::User` to `Runners::Users` (plural, matches API resource)
|
|
26
|
+
- Replaced single `client` helper with named `api_connection`/`webhook_connection` builders
|
|
27
|
+
|
|
28
|
+
### Removed
|
|
29
|
+
- Old `Helpers::Client#client` method (replaced by named builders)
|
|
30
|
+
|
|
31
|
+
## [0.2.0] - 2026-03-15
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
- `Runners::User` with `list_users`, `user_info`, `set_presence`, and `get_presence` methods using Slack Web API Bearer token auth
|
|
35
|
+
- Standalone `Client` class that includes `Helpers::Client`, `Runners::Chat`, and `Runners::User` for use outside the Legion runtime
|
|
36
|
+
- Specs for `Client`, `Runners::Chat` (expanded), and `Runners::User`
|
|
37
|
+
|
|
38
|
+
## [0.1.0] - 2026-03-13
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
- Initial release
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# lex-slack: Slack Integration for LegionIO
|
|
2
|
+
|
|
3
|
+
**Repository Level 3 Documentation**
|
|
4
|
+
- **Parent**: `/Users/miverso2/rubymine/legion/extensions-other/CLAUDE.md`
|
|
5
|
+
- **Grandparent**: `/Users/miverso2/rubymine/legion/CLAUDE.md`
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Comprehensive Legion Extension connecting LegionIO to Slack. Covers the Slack Web API (messaging, conversations, users, reactions, files, pins, bookmarks, reminders, usergroups, views, search), incoming webhooks, Block Kit builder, and a configurable message polling actor.
|
|
10
|
+
|
|
11
|
+
**Version**: 0.3.0
|
|
12
|
+
**GitHub**: https://github.com/LegionIO/lex-slack
|
|
13
|
+
**License**: MIT
|
|
14
|
+
|
|
15
|
+
## Architecture
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Legion::Extensions::Slack
|
|
19
|
+
+-- Helpers/
|
|
20
|
+
| +-- Client # Named builders: api_connection (Web API), webhook_connection
|
|
21
|
+
+-- Runners/
|
|
22
|
+
| +-- Blocks # Pure Block Kit builder (no HTTP)
|
|
23
|
+
| +-- Chat # post_message, send_webhook, update, delete, schedule (6 methods)
|
|
24
|
+
| +-- Conversations # list, info, history, replies, members, join, leave, invite, open, create, archive, topic (12 methods)
|
|
25
|
+
| +-- Users # list, info, lookup_by_email, presence (5 methods)
|
|
26
|
+
| +-- Reactions # add, remove, get, list (4 methods)
|
|
27
|
+
| +-- Files # upload (two-step), list, info, delete, share (5 methods)
|
|
28
|
+
| +-- Pins # add, remove, list (3 methods)
|
|
29
|
+
| +-- Bookmarks # add, edit, remove, list (4 methods)
|
|
30
|
+
| +-- Reminders # add, complete, delete, info, list (5 methods)
|
|
31
|
+
| +-- Usergroups # CRUD + users.list/update (7 methods)
|
|
32
|
+
| +-- Views # open, push, update, publish (4 methods)
|
|
33
|
+
| +-- Search # search_messages, search_files (2 methods)
|
|
34
|
+
+-- Actors/
|
|
35
|
+
| +-- MessagePoller # Poll conversations.history (disabled by default)
|
|
36
|
+
+-- Client # Standalone client including all runners
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Connection Builders
|
|
40
|
+
|
|
41
|
+
Two named Faraday connection builders in `Helpers::Client`:
|
|
42
|
+
- `api_connection(token:, base_url:, **)` — targets `https://slack.com/api/`, Bearer token auth
|
|
43
|
+
- `webhook_connection(base_url:, **)` — targets `https://hooks.slack.com`, no auth
|
|
44
|
+
|
|
45
|
+
All runners use `api_connection` except `Chat#send_webhook` which uses `webhook_connection`.
|
|
46
|
+
|
|
47
|
+
## Standalone Client
|
|
48
|
+
|
|
49
|
+
`Client.new(token:, webhook:, **)` stores credentials in `@opts` and injects them into every connection call via `super(**@opts, **override)`. All 12 runner modules are included. Per-call token override supported.
|
|
50
|
+
|
|
51
|
+
## Actor: MessagePoller
|
|
52
|
+
|
|
53
|
+
Configurable polling actor, disabled by default. Settings:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"lex-slack": {
|
|
58
|
+
"token": "xoxb-...",
|
|
59
|
+
"poller": {
|
|
60
|
+
"enabled": false,
|
|
61
|
+
"interval": 30,
|
|
62
|
+
"channels": [],
|
|
63
|
+
"limit": 50
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Uses in-memory high-water mark per channel. Publishes to Legion transport if available.
|
|
70
|
+
|
|
71
|
+
## Dependencies
|
|
72
|
+
|
|
73
|
+
| Gem | Purpose |
|
|
74
|
+
|-----|---------|
|
|
75
|
+
| `faraday` (>= 2.0) | HTTP client |
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
141 specs across 16 spec files.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
bundle install
|
|
83
|
+
bundle exec rspec
|
|
84
|
+
bundle exec rubocop
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
**Maintained By**: Matthew Iverson (@Esity)
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
lex-slack (0.3.0)
|
|
5
|
+
faraday (>= 2.0)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
addressable (2.8.9)
|
|
11
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
12
|
+
ast (2.4.3)
|
|
13
|
+
bigdecimal (4.0.1)
|
|
14
|
+
diff-lcs (1.6.2)
|
|
15
|
+
faraday (2.14.1)
|
|
16
|
+
faraday-net_http (>= 2.0, < 3.5)
|
|
17
|
+
json
|
|
18
|
+
logger
|
|
19
|
+
faraday-net_http (3.4.2)
|
|
20
|
+
net-http (~> 0.5)
|
|
21
|
+
json (2.19.1)
|
|
22
|
+
json-schema (6.2.0)
|
|
23
|
+
addressable (~> 2.8)
|
|
24
|
+
bigdecimal (>= 3.1, < 5)
|
|
25
|
+
language_server-protocol (3.17.0.5)
|
|
26
|
+
lint_roller (1.1.0)
|
|
27
|
+
logger (1.7.0)
|
|
28
|
+
mcp (0.8.0)
|
|
29
|
+
json-schema (>= 4.1)
|
|
30
|
+
net-http (0.9.1)
|
|
31
|
+
uri (>= 0.11.1)
|
|
32
|
+
parallel (1.27.0)
|
|
33
|
+
parser (3.3.10.2)
|
|
34
|
+
ast (~> 2.4.1)
|
|
35
|
+
racc
|
|
36
|
+
prism (1.9.0)
|
|
37
|
+
public_suffix (7.0.5)
|
|
38
|
+
racc (1.8.1)
|
|
39
|
+
rainbow (3.1.1)
|
|
40
|
+
rake (12.3.3)
|
|
41
|
+
regexp_parser (2.11.3)
|
|
42
|
+
rspec (3.13.2)
|
|
43
|
+
rspec-core (~> 3.13.0)
|
|
44
|
+
rspec-expectations (~> 3.13.0)
|
|
45
|
+
rspec-mocks (~> 3.13.0)
|
|
46
|
+
rspec-core (3.13.6)
|
|
47
|
+
rspec-support (~> 3.13.0)
|
|
48
|
+
rspec-expectations (3.13.5)
|
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
|
+
rspec-support (~> 3.13.0)
|
|
51
|
+
rspec-mocks (3.13.8)
|
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
53
|
+
rspec-support (~> 3.13.0)
|
|
54
|
+
rspec-support (3.13.7)
|
|
55
|
+
rubocop (1.85.1)
|
|
56
|
+
json (~> 2.3)
|
|
57
|
+
language_server-protocol (~> 3.17.0.2)
|
|
58
|
+
lint_roller (~> 1.1.0)
|
|
59
|
+
mcp (~> 0.6)
|
|
60
|
+
parallel (~> 1.10)
|
|
61
|
+
parser (>= 3.3.0.2)
|
|
62
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
63
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
64
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
65
|
+
ruby-progressbar (~> 1.7)
|
|
66
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
67
|
+
rubocop-ast (1.49.1)
|
|
68
|
+
parser (>= 3.3.7.2)
|
|
69
|
+
prism (~> 1.7)
|
|
70
|
+
ruby-progressbar (1.13.0)
|
|
71
|
+
unicode-display_width (3.2.0)
|
|
72
|
+
unicode-emoji (~> 4.1)
|
|
73
|
+
unicode-emoji (4.2.0)
|
|
74
|
+
uri (1.1.1)
|
|
75
|
+
|
|
76
|
+
PLATFORMS
|
|
77
|
+
arm64-darwin-25
|
|
78
|
+
ruby
|
|
79
|
+
|
|
80
|
+
DEPENDENCIES
|
|
81
|
+
bundler (>= 2)
|
|
82
|
+
lex-slack!
|
|
83
|
+
rake
|
|
84
|
+
rspec
|
|
85
|
+
rubocop
|
|
86
|
+
|
|
87
|
+
BUNDLED WITH
|
|
88
|
+
2.6.9
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Esity
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# lex-slack
|
|
2
|
+
|
|
3
|
+
Comprehensive Slack integration for [LegionIO](https://github.com/LegionIO/LegionIO). Covers the Slack Web API (messaging, conversations, users, reactions, files, pins, bookmarks, reminders, usergroups, views, search), incoming webhooks, Block Kit builder, and a configurable message polling actor.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gem install lex-slack
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or add to your Gemfile:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'lex-slack'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Standalone Client
|
|
18
|
+
|
|
19
|
+
Use `Legion::Extensions::Slack::Client` outside the full LegionIO framework. The client stores credentials and injects them into every API call automatically.
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
require 'legion/extensions/slack'
|
|
23
|
+
|
|
24
|
+
client = Legion::Extensions::Slack::Client.new(token: 'xoxb-...')
|
|
25
|
+
|
|
26
|
+
# Messaging
|
|
27
|
+
client.post_message(channel: '#general', text: 'Hello from Legion!')
|
|
28
|
+
client.post_message(channel: '#alerts', text: 'fallback', blocks: [
|
|
29
|
+
client.header(text: 'Incident Alert'),
|
|
30
|
+
client.section(text: client.mrkdwn('*web-prod-03* is unreachable')),
|
|
31
|
+
client.divider,
|
|
32
|
+
client.actions(elements: [
|
|
33
|
+
client.button(text: 'Acknowledge', action_id: 'ack', style: 'primary'),
|
|
34
|
+
client.button(text: 'Escalate', action_id: 'esc', style: 'danger')
|
|
35
|
+
])
|
|
36
|
+
])
|
|
37
|
+
|
|
38
|
+
# Conversations
|
|
39
|
+
channels = client.list_conversations
|
|
40
|
+
history = client.conversation_history(channel: 'C123ABC')
|
|
41
|
+
|
|
42
|
+
# Users
|
|
43
|
+
users = client.list_users
|
|
44
|
+
user = client.lookup_by_email(email: 'jane.doe@example.com')
|
|
45
|
+
|
|
46
|
+
# Reactions
|
|
47
|
+
client.add_reaction(channel: 'C123', timestamp: '1234.5678', name: 'thumbsup')
|
|
48
|
+
|
|
49
|
+
# Files (two-step upload)
|
|
50
|
+
client.upload_file(filename: 'report.csv', content: csv_data, channel: '#reports')
|
|
51
|
+
|
|
52
|
+
# Webhooks (no token needed)
|
|
53
|
+
webhook_client = Legion::Extensions::Slack::Client.new(webhook: '/services/T.../B.../...')
|
|
54
|
+
webhook_client.send_webhook(message: 'Quick alert!')
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Runners
|
|
58
|
+
|
|
59
|
+
### Chat
|
|
60
|
+
|
|
61
|
+
| Method | Key Parameters | Description |
|
|
62
|
+
|--------|---------------|-------------|
|
|
63
|
+
| `post_message` | `channel:, text:, blocks:, thread_ts:` | Post a message (supports Block Kit) |
|
|
64
|
+
| `send_webhook` | `message:, webhook:` | Post via incoming webhook |
|
|
65
|
+
| `update_message` | `channel:, ts:, text:, blocks:` | Update an existing message |
|
|
66
|
+
| `delete_message` | `channel:, ts:` | Delete a message |
|
|
67
|
+
| `schedule_message` | `channel:, text:, post_at:` | Schedule a future message |
|
|
68
|
+
| `delete_scheduled` | `channel:, scheduled_message_id:` | Cancel a scheduled message |
|
|
69
|
+
|
|
70
|
+
### Conversations
|
|
71
|
+
|
|
72
|
+
| Method | Key Parameters | Description |
|
|
73
|
+
|--------|---------------|-------------|
|
|
74
|
+
| `list_conversations` | `types:, cursor:, limit:` | List channels |
|
|
75
|
+
| `conversation_info` | `channel:` | Get channel details |
|
|
76
|
+
| `conversation_history` | `channel:, oldest:, latest:` | Fetch message history |
|
|
77
|
+
| `conversation_replies` | `channel:, ts:` | Fetch thread replies |
|
|
78
|
+
| `conversation_members` | `channel:` | List channel members |
|
|
79
|
+
| `join_conversation` | `channel:` | Join a channel |
|
|
80
|
+
| `leave_conversation` | `channel:` | Leave a channel |
|
|
81
|
+
| `invite_to_conversation` | `channel:, users:` | Invite users to a channel |
|
|
82
|
+
| `open_conversation` | `users:` | Open or resume a DM |
|
|
83
|
+
| `create_conversation` | `name:, is_private:` | Create a channel |
|
|
84
|
+
| `archive_conversation` | `channel:` | Archive a channel |
|
|
85
|
+
| `set_conversation_topic` | `channel:, topic:` | Set the channel topic |
|
|
86
|
+
|
|
87
|
+
### Users
|
|
88
|
+
|
|
89
|
+
| Method | Key Parameters | Description |
|
|
90
|
+
|--------|---------------|-------------|
|
|
91
|
+
| `list_users` | `cursor:, limit:` | List workspace users |
|
|
92
|
+
| `user_info` | `user:` | Get user details |
|
|
93
|
+
| `lookup_by_email` | `email:` | Find user by email |
|
|
94
|
+
| `get_presence` | `user:` | Get presence status |
|
|
95
|
+
| `set_presence` | `presence:` | Set bot presence (`auto`/`away`) |
|
|
96
|
+
|
|
97
|
+
### Reactions
|
|
98
|
+
|
|
99
|
+
| Method | Key Parameters | Description |
|
|
100
|
+
|--------|---------------|-------------|
|
|
101
|
+
| `add_reaction` | `channel:, timestamp:, name:` | Add a reaction |
|
|
102
|
+
| `remove_reaction` | `channel:, timestamp:, name:` | Remove a reaction |
|
|
103
|
+
| `get_reactions` | `channel:, timestamp:` | Get reactions on a message |
|
|
104
|
+
| `list_reactions` | `user:, cursor:` | List reactions by a user |
|
|
105
|
+
|
|
106
|
+
### Files
|
|
107
|
+
|
|
108
|
+
| Method | Key Parameters | Description |
|
|
109
|
+
|--------|---------------|-------------|
|
|
110
|
+
| `upload_file` | `filename:, content:, channel:` | Upload via two-step external flow |
|
|
111
|
+
| `list_files` | `channel:, user:, types:` | List files |
|
|
112
|
+
| `file_info` | `file:` | Get file details |
|
|
113
|
+
| `delete_file` | `file:` | Delete a file |
|
|
114
|
+
| `share_file` | `file:` | Create a public URL for a file |
|
|
115
|
+
|
|
116
|
+
### Pins
|
|
117
|
+
|
|
118
|
+
| Method | Key Parameters | Description |
|
|
119
|
+
|--------|---------------|-------------|
|
|
120
|
+
| `add_pin` | `channel:, timestamp:` | Pin a message |
|
|
121
|
+
| `remove_pin` | `channel:, timestamp:` | Unpin a message |
|
|
122
|
+
| `list_pins` | `channel:` | List pinned items |
|
|
123
|
+
|
|
124
|
+
### Bookmarks
|
|
125
|
+
|
|
126
|
+
| Method | Key Parameters | Description |
|
|
127
|
+
|--------|---------------|-------------|
|
|
128
|
+
| `add_bookmark` | `channel:, title:, type:, link:` | Add a bookmark |
|
|
129
|
+
| `edit_bookmark` | `channel:, bookmark_id:` | Edit a bookmark |
|
|
130
|
+
| `remove_bookmark` | `channel:, bookmark_id:` | Remove a bookmark |
|
|
131
|
+
| `list_bookmarks` | `channel:` | List bookmarks |
|
|
132
|
+
|
|
133
|
+
### Reminders
|
|
134
|
+
|
|
135
|
+
| Method | Key Parameters | Description |
|
|
136
|
+
|--------|---------------|-------------|
|
|
137
|
+
| `add_reminder` | `text:, time:, user:` | Create a reminder |
|
|
138
|
+
| `complete_reminder` | `reminder:` | Mark complete |
|
|
139
|
+
| `delete_reminder` | `reminder:` | Delete a reminder |
|
|
140
|
+
| `reminder_info` | `reminder:` | Get reminder details |
|
|
141
|
+
| `list_reminders` | | List all reminders |
|
|
142
|
+
|
|
143
|
+
### Usergroups
|
|
144
|
+
|
|
145
|
+
| Method | Key Parameters | Description |
|
|
146
|
+
|--------|---------------|-------------|
|
|
147
|
+
| `list_usergroups` | `include_users:, include_disabled:` | List usergroups |
|
|
148
|
+
| `create_usergroup` | `name:, handle:` | Create a usergroup |
|
|
149
|
+
| `update_usergroup` | `usergroup:, name:` | Update a usergroup |
|
|
150
|
+
| `disable_usergroup` | `usergroup:` | Disable a usergroup |
|
|
151
|
+
| `enable_usergroup` | `usergroup:` | Re-enable a usergroup |
|
|
152
|
+
| `list_usergroup_users` | `usergroup:` | List members |
|
|
153
|
+
| `update_usergroup_users` | `usergroup:, users:` | Set members |
|
|
154
|
+
|
|
155
|
+
### Views
|
|
156
|
+
|
|
157
|
+
| Method | Key Parameters | Description |
|
|
158
|
+
|--------|---------------|-------------|
|
|
159
|
+
| `open_view` | `trigger_id:, view:` | Open a modal |
|
|
160
|
+
| `push_view` | `trigger_id:, view:` | Push a view onto the stack |
|
|
161
|
+
| `update_view` | `view_id:, view:` | Update an existing view |
|
|
162
|
+
| `publish_view` | `user_id:, view:` | Publish an App Home tab |
|
|
163
|
+
|
|
164
|
+
### Search
|
|
165
|
+
|
|
166
|
+
| Method | Key Parameters | Description |
|
|
167
|
+
|--------|---------------|-------------|
|
|
168
|
+
| `search_messages` | `query:, sort:, count:` | Search messages (requires user token) |
|
|
169
|
+
| `search_files` | `query:, sort:, count:` | Search files (requires user token) |
|
|
170
|
+
|
|
171
|
+
### Blocks (Builder)
|
|
172
|
+
|
|
173
|
+
Pure Ruby helpers for constructing Block Kit payloads. No HTTP calls.
|
|
174
|
+
|
|
175
|
+
| Method | Description |
|
|
176
|
+
|--------|-------------|
|
|
177
|
+
| `mrkdwn(text)` | Markdown text object |
|
|
178
|
+
| `plain_text(text)` | Plain text object |
|
|
179
|
+
| `option(text:, value:)` | Select menu option |
|
|
180
|
+
| `section(text:, accessory:, fields:)` | Section block |
|
|
181
|
+
| `divider` | Divider block |
|
|
182
|
+
| `header(text:)` | Header block |
|
|
183
|
+
| `context(elements:)` | Context block |
|
|
184
|
+
| `actions(elements:)` | Actions block |
|
|
185
|
+
| `image(image_url:, alt_text:)` | Image block |
|
|
186
|
+
| `input(label:, element:)` | Input block |
|
|
187
|
+
| `file_block(external_id:)` | File block |
|
|
188
|
+
| `button(text:, action_id:)` | Button element |
|
|
189
|
+
| `overflow_menu(action_id:, options:)` | Overflow menu |
|
|
190
|
+
| `static_select(action_id:, placeholder:, options:)` | Static select |
|
|
191
|
+
| `multi_static_select(action_id:, placeholder:, options:)` | Multi-select |
|
|
192
|
+
| `datepicker(action_id:)` | Date picker |
|
|
193
|
+
|
|
194
|
+
## Message Poller Actor
|
|
195
|
+
|
|
196
|
+
A configurable polling actor that watches channels for new messages. Disabled by default.
|
|
197
|
+
|
|
198
|
+
Configure via Legion::Settings:
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"lex-slack": {
|
|
203
|
+
"token": "xoxb-...",
|
|
204
|
+
"poller": {
|
|
205
|
+
"enabled": true,
|
|
206
|
+
"interval": 30,
|
|
207
|
+
"channels": ["C123ABC", "C456DEF"],
|
|
208
|
+
"limit": 50
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
The poller uses an in-memory high-water mark per channel to avoid reprocessing messages. New messages are published to Legion transport if available.
|
|
215
|
+
|
|
216
|
+
## Requirements
|
|
217
|
+
|
|
218
|
+
- Ruby >= 3.4
|
|
219
|
+
- `faraday` >= 2.0
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
MIT
|
data/Rakefile
ADDED
data/lex-slack.gemspec
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/legion/extensions/slack/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'lex-slack'
|
|
7
|
+
spec.version = Legion::Extensions::Slack::VERSION
|
|
8
|
+
spec.authors = ['Esity']
|
|
9
|
+
spec.email = ['matthewdiverson@gmail.com']
|
|
10
|
+
|
|
11
|
+
spec.summary = 'LEX::Slack'
|
|
12
|
+
spec.description = 'Connects Legion to Slack via Web API and incoming webhooks'
|
|
13
|
+
spec.homepage = 'https://github.com/LegionIO/lex-slack'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
spec.required_ruby_version = '>= 3.4'
|
|
16
|
+
|
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-slack'
|
|
19
|
+
spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-slack'
|
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-slack'
|
|
21
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-slack/issues'
|
|
22
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
25
|
+
end
|
|
26
|
+
spec.require_paths = ['lib']
|
|
27
|
+
|
|
28
|
+
spec.add_dependency 'faraday', '>= 2.0'
|
|
29
|
+
end
|