Module: Slack::Web::Api::Endpoints::Groups

Included in:
Slack::Web::Api::Endpoints
Defined in:
lib/slack/web/api/endpoints/groups.rb

Instance Method Summary collapse

Instance Method Details

#groups_archive(options = {}) ⇒ Object

Archives a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to archive.

See Also:



16
17
18
19
20
21
# File 'lib/slack/web/api/endpoints/groups.rb', line 16

def groups_archive(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.archive: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.archive.')
  post('groups.archive', options)
end

#groups_create(options = {}) ⇒ Object

Creates a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :name (Object)

    Name of private channel to create.

  • :validate (Object)

    Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.

See Also:



32
33
34
35
36
# File 'lib/slack/web/api/endpoints/groups.rb', line 32

def groups_create(options = {})
  throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
  logger.warn('groups.create: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.create.')
  post('groups.create', options)
end

#groups_createChild(options = {}) ⇒ Object

Clones and archives a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to clone and archive.

See Also:



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

def groups_createChild(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.createChild: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .')
  post('groups.createChild', options)
end

#groups_history(options = {}) ⇒ Object

Fetches history of messages and events from a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to fetch history for.

  • :inclusive (Object)

    Include messages with latest or oldest timestamp in results.

  • :latest (timestamp)

    End of time range of messages to include in results.

  • :oldest (timestamp)

    Start of time range of messages to include in results.

  • :unreads (Object)

    Include unread_count_display in the output?.

See Also:



67
68
69
70
71
72
# File 'lib/slack/web/api/endpoints/groups.rb', line 67

def groups_history(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.history: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.history.')
  post('groups.history', options)
end

#groups_info(options = {}) ⇒ Object

Gets information about a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to get info on.

  • :include_locale (Object)

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

See Also:



83
84
85
86
87
88
# File 'lib/slack/web/api/endpoints/groups.rb', line 83

def groups_info(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.info: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.info.')
  post('groups.info', options)
end

#groups_invite(options = {}) ⇒ Object

Invites a user to a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to invite user to.

  • :user (user)

    User to invite.

See Also:



99
100
101
102
103
104
105
106
# File 'lib/slack/web/api/endpoints/groups.rb', line 99

def groups_invite(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: groups_id(options)['group']['id']) if options[:channel]
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
  logger.warn('groups.invite: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.invite.')
  post('groups.invite', options)
end

#groups_kick(options = {}) ⇒ Object

Removes a user from a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to remove user from.

  • :user (user)

    User to remove from private channel.

See Also:



117
118
119
120
121
122
123
124
# File 'lib/slack/web/api/endpoints/groups.rb', line 117

def groups_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: groups_id(options)['group']['id']) if options[:channel]
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
  logger.warn('groups.kick: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.kick.')
  post('groups.kick', options)
end

#groups_leave(options = {}) ⇒ Object

Leaves a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to leave.

See Also:



133
134
135
136
137
138
# File 'lib/slack/web/api/endpoints/groups.rb', line 133

def groups_leave(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.leave: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.leave.')
  post('groups.leave', options)
end

#groups_list(options = {}) ⇒ Object

Lists private channels that the calling user has access to.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :cursor (Object)

    Parameter for pagination. Set cursor equal to the next_cursor attribute returned by the previous request’s response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first “page” of the collection. See pagination for more details.

  • :exclude_archived (Object)

    Don’t return archived private channels.

  • :exclude_members (Object)

    Exclude the members from each group.

  • :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.

See Also:



153
154
155
156
157
158
159
160
161
162
# File 'lib/slack/web/api/endpoints/groups.rb', line 153

def groups_list(options = {})
  logger.warn('groups.list: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.list, users.conversations.')
  if block_given?
    Pagination::Cursor.new(self, :groups_list, options).each do |page|
      yield page
    end
  else
    post('groups.list', options)
  end
end

#groups_mark(options = {}) ⇒ Object

Sets the read cursor in a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to set reading cursor in.

  • :ts (timestamp)

    Timestamp of the most recently seen message.

See Also:



173
174
175
176
177
178
179
# File 'lib/slack/web/api/endpoints/groups.rb', line 173

def groups_mark(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: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .')
  post('groups.mark', options)
end

#groups_open(options = {}) ⇒ Object

Opens a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to open.

See Also:



188
189
190
191
192
193
# File 'lib/slack/web/api/endpoints/groups.rb', line 188

def groups_open(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.open: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: .')
  post('groups.open', options)
end

#groups_rename(options = {}) ⇒ Object

Renames a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to rename.

  • :name (Object)

    New name for private channel.

  • :validate (Object)

    Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.

See Also:



206
207
208
209
210
211
212
# File 'lib/slack/web/api/endpoints/groups.rb', line 206

def groups_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: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.rename: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.rename.')
  post('groups.rename', options)
end

#groups_replies(options = {}) ⇒ Object

Retrieve a thread of messages posted to a private channel

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to fetch thread from.

  • :thread_ts (Object)

    Unique identifier of a thread’s parent message.

See Also:



223
224
225
226
227
228
229
# File 'lib/slack/web/api/endpoints/groups.rb', line 223

def groups_replies(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.replies: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.replies.')
  post('groups.replies', options)
end

#groups_setPurpose(options = {}) ⇒ Object

Sets the purpose for a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to set the purpose of.

  • :purpose (Object)

    The new purpose.

See Also:



240
241
242
243
244
245
246
# File 'lib/slack/web/api/endpoints/groups.rb', line 240

def groups_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: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.setPurpose: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.setPurpose.')
  post('groups.setPurpose', options)
end

#groups_setTopic(options = {}) ⇒ Object

Sets the topic for a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to set the topic of.

  • :topic (Object)

    The new topic.

See Also:



257
258
259
260
261
262
263
# File 'lib/slack/web/api/endpoints/groups.rb', line 257

def groups_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: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.setTopic: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.setTopic.')
  post('groups.setTopic', options)
end

#groups_unarchive(options = {}) ⇒ Object

Unarchives a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (group)

    Private channel to unarchive.

See Also:



272
273
274
275
276
277
# File 'lib/slack/web/api/endpoints/groups.rb', line 272

def groups_unarchive(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
  logger.warn('groups.unarchive: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.unarchive.')
  post('groups.unarchive', options)
end