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

Instance Method Details

#conversations_archive(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    ID of conversation to archive.

See Also:



15
16
17
18
19
# File 'lib/slack/web/api/endpoints/conversations.rb', line 15

def conversations_archive(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.archive', options)
end

#conversations_close(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Conversation to close.

See Also:



28
29
30
31
32
# File 'lib/slack/web/api/endpoints/conversations.rb', line 28

def conversations_close(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.close', options)
end

#conversations_create(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :name (Object)

    Name of the public or private channel to create.

  • :is_private (Object)

    Create a private channel instead of a public one.

  • :user_ids (Object)

    Required for workspace apps. A list of between 1 and 30 human users that will be added to the newly-created conversation. This argument has no effect when used by classic Slack apps.

See Also:



45
46
47
48
# File 'lib/slack/web/api/endpoints/conversations.rb', line 45

def conversations_create(options = {})
  throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
  post('conversations.create', options)
end

#conversations_history(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Conversation ID to fetch history for.

  • :cursor (Object)

    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. See pagination for more detail.

  • :inclusive (Object)

    Include messages with latest or oldest timestamp in results only when either timestamp is specified.

  • :latest (timestamp)

    End of time range of messages to include in results.

  • :limit (Object)

    The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn’t been reached.

  • :oldest (timestamp)

    Start of time range of messages to include in results.

See Also:



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/slack/web/api/endpoints/conversations.rb', line 67

def conversations_history(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  if block_given?
    Pagination::Cursor.new(self, :conversations_history, options).each do |page|
      yield page
    end
  else
    post('conversations.history', options)
  end
end

#conversations_info(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Conversation ID to learn more about.

  • :include_locale (Object)

    Set this to true to receive the locale for this conversation. Defaults to false.

  • :include_num_members (Object)

    Set to true to include the member count for the specified conversation. Defaults to false.

See Also:



90
91
92
93
94
# File 'lib/slack/web/api/endpoints/conversations.rb', line 90

def conversations_info(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.info', options)
end

#conversations_invite(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    The ID of the public or private channel to invite user(s) to.

  • :users (Object)

    A comma separated list of user IDs. Up to 30 users may be listed.

See Also:



105
106
107
108
109
110
# File 'lib/slack/web/api/endpoints/conversations.rb', line 105

def conversations_invite(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.invite', options)
end

#conversations_join(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    ID of conversation to join.

See Also:



119
120
121
122
123
# File 'lib/slack/web/api/endpoints/conversations.rb', line 119

def conversations_join(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.join', options)
end

#conversations_kick(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    ID of conversation to remove user from.

  • :user (user)

    User ID to be removed.

See Also:



134
135
136
137
138
139
140
# File 'lib/slack/web/api/endpoints/conversations.rb', line 134

def conversations_kick(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
  post('conversations.kick', options)
end

#conversations_leave(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Conversation to leave.

See Also:



149
150
151
152
153
# File 'lib/slack/web/api/endpoints/conversations.rb', line 149

def conversations_leave(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.leave', options)
end

#conversations_list(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :cursor (Object)

    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. See pagination for more detail.

  • :exclude_archived (Object)

    Set to true to exclude archived channels from the list.

  • :limit (Object)

    The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn’t been reached. Must be an integer no larger than 1000.

  • :types (Object)

    Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.

See Also:



168
169
170
171
172
173
174
175
176
# File 'lib/slack/web/api/endpoints/conversations.rb', line 168

def conversations_list(options = {})
  if block_given?
    Pagination::Cursor.new(self, :conversations_list, options).each do |page|
      yield page
    end
  else
    post('conversations.list', options)
  end
end

#conversations_members(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    ID of the conversation to retrieve members for.

  • :cursor (Object)

    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. See pagination for more detail.

  • :limit (Object)

    The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn’t been reached.

See Also:



189
190
191
192
193
194
195
196
197
198
199
# File 'lib/slack/web/api/endpoints/conversations.rb', line 189

def conversations_members(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  if block_given?
    Pagination::Cursor.new(self, :conversations_members, options).each do |page|
      yield page
    end
  else
    post('conversations.members', options)
  end
end

#conversations_open(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Resume a conversation by supplying an im or mpim’s ID. Or provide the users field instead.

  • :return_im (Object)

    Boolean, indicates you want the full IM channel definition in the response.

  • :users (Object)

    Comma separated lists of users. If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users.

See Also:



212
213
214
215
# File 'lib/slack/web/api/endpoints/conversations.rb', line 212

def conversations_open(options = {})
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.open', options)
end

#conversations_rename(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    ID of conversation to rename.

  • :name (Object)

    New name for conversation.

See Also:



226
227
228
229
230
231
# File 'lib/slack/web/api/endpoints/conversations.rb', line 226

def conversations_rename(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.rename', options)
end

#conversations_replies(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Conversation ID to fetch thread from.

  • :ts (timestamp)

    Unique identifier of a thread’s parent message.

  • :cursor (Object)

    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. See pagination for more detail.

  • :inclusive (Object)

    Include messages with latest or oldest timestamp in results only when either timestamp is specified.

  • :latest (timestamp)

    End of time range of messages to include in results.

  • :limit (Object)

    The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn’t been reached.

  • :oldest (timestamp)

    Start of time range of messages to include in results.

See Also:



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(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  if block_given?
    Pagination::Cursor.new(self, :conversations_replies, options).each do |page|
      yield page
    end
  else
    post('conversations.replies', options)
  end
end

#conversations_setPurpose(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Conversation to set the purpose of.

  • :purpose (Object)

    A new, specialer purpose.

See Also:



274
275
276
277
278
279
# File 'lib/slack/web/api/endpoints/conversations.rb', line 274

def conversations_setPurpose(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.setPurpose', options)
end

#conversations_setTopic(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Conversation to set the topic of.

  • :topic (Object)

    The new topic string. Does not support formatting or linkification.

See Also:



290
291
292
293
294
295
# File 'lib/slack/web/api/endpoints/conversations.rb', line 290

def conversations_setTopic(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.setTopic', options)
end

#conversations_unarchive(options = {}) ⇒ Object

As part of the Conversations API, this method’s required scopes depend on the type of channel-like object you’re working with. For classic Slack apps, a corresponding channels: scope is required when working with public channels, groups: for private channels, also the same rules are applied for im: and mpim:. For workspace apps, a conversations: scope is all that’s needed.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    ID of conversation to unarchive.

See Also:



304
305
306
307
308
# File 'lib/slack/web/api/endpoints/conversations.rb', line 304

def conversations_unarchive(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
  post('conversations.unarchive', options)
end