Module: Slack::Web::Api::Endpoints::Conversations
- Included in:
- Slack::Web::Api::Endpoints
- Defined in:
- lib/slack/web/api/endpoints/conversations.rb
Instance Method Summary collapse
-
#conversations_archive(options = {}) ⇒ Object
This method archives a conversation.
-
#conversations_close(options = {}) ⇒ Object
This Conversations API method closes direct messages, multi-person or 1:1 or otherwise.
-
#conversations_create(options = {}) ⇒ Object
Create a public or private channel using this Conversations API method.
-
#conversations_history(options = {}) ⇒ Object
This method returns a portion of message events from the specified conversation.
-
#conversations_info(options = {}) ⇒ Object
This Conversations API method returns information about a workspace conversation.
-
#conversations_invite(options = {}) ⇒ Object
This Conversations API method invites 1-30 users to a public or private channel.
-
#conversations_join(options = {}) ⇒ Object
This Conversations API method joins a user to an existing conversation.
-
#conversations_kick(options = {}) ⇒ Object
This Conversations API method allows a user to remove another member from a channel.
-
#conversations_leave(options = {}) ⇒ Object
This Conversations API method makes like a tree and leaves a conversation.
-
#conversations_list(options = {}) ⇒ Object
This Conversations API method returns a list of all channel-like conversations in a workspace.
-
#conversations_members(options = {}) ⇒ Object
This Conversations API method returns a paginated list of members party to a conversation.
-
#conversations_open(options = {}) ⇒ Object
This Conversations API method opens a multi-person direct message or just a 1:1 direct message.
-
#conversations_rename(options = {}) ⇒ Object
This method renames a conversation.
-
#conversations_replies(options = {}) ⇒ Object
This Conversations API method returns an entire thread (a message plus all the messages in reply to it), while conversations.history method returns only parent messages.
-
#conversations_setPurpose(options = {}) ⇒ Object
This method is used to change the purpose of a conversation.
-
#conversations_setTopic(options = {}) ⇒ Object
This method is used to change the topic of a conversation.
-
#conversations_unarchive(options = {}) ⇒ Object
This method unarchives a conversation.
Instance Method Details
#conversations_archive(options = {}) ⇒ Object
This method archives a conversation. Not all types of conversations can be archived.
15 16 17 18 19 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 15 def conversations_archive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.archive', ) end |
#conversations_close(options = {}) ⇒ Object
This Conversations API method closes direct messages, multi-person or 1:1 or otherwise.
28 29 30 31 32 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 28 def conversations_close( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.close', ) end |
#conversations_create(options = {}) ⇒ Object
Create a public or private channel using this Conversations API method.
45 46 47 48 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 45 def conversations_create( = {}) throw ArgumentError.new('Required arguments :name missing') if [:name].nil? post('conversations.create', ) end |
#conversations_history(options = {}) ⇒ Object
This method returns a portion of message events from the specified conversation.
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 67 def conversations_history( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] if block_given? Pagination::Cursor.new(self, :conversations_history, ).each do |page| yield page end else post('conversations.history', ) end end |
#conversations_info(options = {}) ⇒ Object
This Conversations API method returns information about a workspace conversation.
90 91 92 93 94 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 90 def conversations_info( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.info', ) end |
#conversations_invite(options = {}) ⇒ Object
This Conversations API method invites 1-30 users to a public or private channel. The calling user must be a member of the channel.
105 106 107 108 109 110 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 105 def conversations_invite( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :users missing') if [:users].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.invite', ) end |
#conversations_join(options = {}) ⇒ Object
This Conversations API method joins a user to an existing conversation.
119 120 121 122 123 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 119 def conversations_join( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.join', ) end |
#conversations_kick(options = {}) ⇒ Object
This Conversations API method allows a user to remove another member from a channel.
134 135 136 137 138 139 140 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 134 def conversations_kick( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] = .merge(user: users_id()['user']['id']) if [:user] post('conversations.kick', ) end |
#conversations_leave(options = {}) ⇒ Object
This Conversations API method makes like a tree and leaves a conversation.
149 150 151 152 153 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 149 def conversations_leave( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.leave', ) end |
#conversations_list(options = {}) ⇒ Object
This Conversations API method returns a list of all channel-like conversations in a workspace. The “channels” returned depend on what the calling token has access to and the directives placed in the types parameter.
168 169 170 171 172 173 174 175 176 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 168 def conversations_list( = {}) if block_given? Pagination::Cursor.new(self, :conversations_list, ).each do |page| yield page end else post('conversations.list', ) end end |
#conversations_members(options = {}) ⇒ Object
This Conversations API method returns a paginated list of members party to a conversation.
189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 189 def conversations_members( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] if block_given? Pagination::Cursor.new(self, :conversations_members, ).each do |page| yield page end else post('conversations.members', ) end end |
#conversations_open(options = {}) ⇒ Object
This Conversations API method opens a multi-person direct message or just a 1:1 direct message.
212 213 214 215 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 212 def conversations_open( = {}) = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.open', ) end |
#conversations_rename(options = {}) ⇒ Object
This method renames a conversation. Some types of conversations cannot be renamed.
226 227 228 229 230 231 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 226 def conversations_rename( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :name missing') if [:name].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.rename', ) end |
#conversations_replies(options = {}) ⇒ Object
This Conversations API method returns an entire thread (a message plus all the messages in reply to it), while conversations.history method returns only parent messages.
252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 252 def conversations_replies( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] if block_given? Pagination::Cursor.new(self, :conversations_replies, ).each do |page| yield page end else post('conversations.replies', ) end end |
#conversations_setPurpose(options = {}) ⇒ Object
This method is used to change the purpose of a conversation. The calling user must be a member of the conversation. Not all conversation types may have a purpose set.
274 275 276 277 278 279 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 274 def conversations_setPurpose( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :purpose missing') if [:purpose].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.setPurpose', ) end |
#conversations_setTopic(options = {}) ⇒ Object
This method is used to change the topic of a conversation. The calling user must be a member of the conversation. Not all conversation types support a new topic.
290 291 292 293 294 295 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 290 def conversations_setTopic( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :topic missing') if [:topic].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.setTopic', ) end |
#conversations_unarchive(options = {}) ⇒ Object
This method unarchives a conversation. The calling user is added to the conversation.
304 305 306 307 308 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 304 def conversations_unarchive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.unarchive', ) end |