Class: Leash::Integration::SlackClient
- Inherits:
-
Object
- Object
- Leash::Integration::SlackClient
- Defined in:
- lib/leash/integration/slack.rb
Instance Method Summary collapse
-
#initialize(leash) ⇒ SlackClient
constructor
Create a new Slack integration client.
-
#slack_add_reaction(channel_id, timestamp, reaction) ⇒ Object
Add a reaction emoji to a message.
-
#slack_get_channel_history(channel_id, limit: nil) ⇒ Object
Get recent messages from a channel.
-
#slack_get_thread_replies(channel_id, thread_ts) ⇒ Object
Get all replies in a message thread.
-
#slack_get_user_profile(user_id) ⇒ Object
Get detailed profile information for a specific user.
-
#slack_get_users(cursor: nil, limit: nil) ⇒ Object
Get a list of all users in the workspace with their basic profile information.
-
#slack_list_channels(limit: nil, cursor: nil) ⇒ Object
List public or pre-defined channels in the workspace with pagination.
-
#slack_post_message(channel_id, text) ⇒ Object
Post a new message to a Slack channel.
-
#slack_reply_to_thread(channel_id, thread_ts, text) ⇒ Object
Reply to a specific message thread in Slack.
Constructor Details
#initialize(leash) ⇒ SlackClient
Create a new Slack integration client.
11 12 13 |
# File 'lib/leash/integration/slack.rb', line 11 def initialize(leash) @leash = leash end |
Instance Method Details
#slack_add_reaction(channel_id, timestamp, reaction) ⇒ Object
Add a reaction emoji to a message
62 63 64 65 66 67 68 69 |
# File 'lib/leash/integration/slack.rb', line 62 def slack_add_reaction(channel_id, , reaction) params = { 'channel_id' => channel_id, 'timestamp' => , 'reaction' => reaction }.compact @leash.call('slack', 'slack_add_reaction', params) end |
#slack_get_channel_history(channel_id, limit: nil) ⇒ Object
Get recent messages from a channel
76 77 78 79 80 81 82 |
# File 'lib/leash/integration/slack.rb', line 76 def slack_get_channel_history(channel_id, limit: nil) params = { 'channel_id' => channel_id, 'limit' => limit }.compact @leash.call('slack', 'slack_get_channel_history', params) end |
#slack_get_thread_replies(channel_id, thread_ts) ⇒ Object
Get all replies in a message thread
89 90 91 92 93 94 95 |
# File 'lib/leash/integration/slack.rb', line 89 def slack_get_thread_replies(channel_id, thread_ts) params = { 'channel_id' => channel_id, 'thread_ts' => thread_ts }.compact @leash.call('slack', 'slack_get_thread_replies', params) end |
#slack_get_user_profile(user_id) ⇒ Object
Get detailed profile information for a specific user
114 115 116 117 118 119 |
# File 'lib/leash/integration/slack.rb', line 114 def slack_get_user_profile(user_id) params = { 'user_id' => user_id }.compact @leash.call('slack', 'slack_get_user_profile', params) end |
#slack_get_users(cursor: nil, limit: nil) ⇒ Object
Get a list of all users in the workspace with their basic profile information
102 103 104 105 106 107 108 |
# File 'lib/leash/integration/slack.rb', line 102 def slack_get_users(cursor: nil, limit: nil) params = { 'cursor' => cursor, 'limit' => limit }.compact @leash.call('slack', 'slack_get_users', params) end |
#slack_list_channels(limit: nil, cursor: nil) ⇒ Object
List public or pre-defined channels in the workspace with pagination
20 21 22 23 24 25 26 |
# File 'lib/leash/integration/slack.rb', line 20 def slack_list_channels(limit: nil, cursor: nil) params = { 'limit' => limit, 'cursor' => cursor }.compact @leash.call('slack', 'slack_list_channels', params) end |
#slack_post_message(channel_id, text) ⇒ Object
Post a new message to a Slack channel
33 34 35 36 37 38 39 |
# File 'lib/leash/integration/slack.rb', line 33 def (channel_id, text) params = { 'channel_id' => channel_id, 'text' => text }.compact @leash.call('slack', 'slack_post_message', params) end |
#slack_reply_to_thread(channel_id, thread_ts, text) ⇒ Object
Reply to a specific message thread in Slack
47 48 49 50 51 52 53 54 |
# File 'lib/leash/integration/slack.rb', line 47 def slack_reply_to_thread(channel_id, thread_ts, text) params = { 'channel_id' => channel_id, 'thread_ts' => thread_ts, 'text' => text }.compact @leash.call('slack', 'slack_reply_to_thread', params) end |