Module: Slack::Web::Api::Endpoints::AdminConversations

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

Instance Method Summary collapse

Instance Method Details

#admin_conversations_archive(options = {}) ⇒ Object

Archive a public or private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to archive.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_archive(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.archive', options)
end

#admin_conversations_bulkArchive(options = {}) ⇒ Object

Archive public or private channels in bulk.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_ids (array)

    An array of channel IDs to archive. No more than 100 items are allowed.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_bulkArchive(options = {})
  raise ArgumentError, 'Required arguments :channel_ids missing' if options[:channel_ids].nil?
  post('admin.conversations.bulkArchive', options)
end

#admin_conversations_bulkDelete(options = {}) ⇒ Object

Delete public or private channels in bulk

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_ids (array)

    An array of channel IDs.

Raises:

  • (ArgumentError)

See Also:



40
41
42
43
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 40

def admin_conversations_bulkDelete(options = {})
  raise ArgumentError, 'Required arguments :channel_ids missing' if options[:channel_ids].nil?
  post('admin.conversations.bulkDelete', options)
end

#admin_conversations_bulkMove(options = {}) ⇒ Object

Move public or private channels in bulk.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_ids (array)

    An array of channel IDs.

  • :target_team_id (string)

    Target team ID.

Raises:

  • (ArgumentError)

See Also:



54
55
56
57
58
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 54

def admin_conversations_bulkMove(options = {})
  raise ArgumentError, 'Required arguments :channel_ids missing' if options[:channel_ids].nil?
  raise ArgumentError, 'Required arguments :target_team_id missing' if options[:target_team_id].nil?
  post('admin.conversations.bulkMove', options)
end

#admin_conversations_convertToPrivate(options = {}) ⇒ Object

Convert a public channel to a private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to convert to private.

  • :name (string)

    Name of private channel to create. Only respected when converting an MPIM.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_convertToPrivate(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.convertToPrivate', options)
end

#admin_conversations_convertToPublic(options = {}) ⇒ Object

Convert a private channel to a public channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to convert to public.

Raises:

  • (ArgumentError)

See Also:



81
82
83
84
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 81

def admin_conversations_convertToPublic(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.convertToPublic', options)
end

#admin_conversations_create(options = {}) ⇒ Object

Create a public or private channel-based conversation.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :is_private (boolean)

    When true, creates a private channel instead of a public channel.

  • :name (string)

    Name of the public or private channel to create.

  • :description (string)

    Description of the public or private channel to create.

  • :org_wide (boolean)

    When true, the channel will be available org-wide. Note: if the channel is not org_wide=true, you must specify a team_id for this channel.

  • :team_id (Object)

    The workspace to create the channel in. Note: this argument is required unless you set org_wide=true.

Raises:

  • (ArgumentError)

See Also:



101
102
103
104
105
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 101

def admin_conversations_create(options = {})
  raise ArgumentError, 'Required arguments :is_private missing' if options[:is_private].nil?
  raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
  post('admin.conversations.create', options)
end

#admin_conversations_delete(options = {}) ⇒ Object

Delete a public or private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to delete.

Raises:

  • (ArgumentError)

See Also:



114
115
116
117
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 114

def admin_conversations_delete(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.delete', options)
end

#admin_conversations_disconnectShared(options = {}) ⇒ Object

Disconnect a connected channel from one or more workspaces.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to be disconnected from some workspaces.

  • :leaving_team_ids (array)

    team IDs getting removed from the channel, optional if there are only two teams in the channel.

Raises:

  • (ArgumentError)

See Also:



128
129
130
131
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 128

def admin_conversations_disconnectShared(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.disconnectShared', options)
end

#admin_conversations_getConversationPrefs(options = {}) ⇒ Object

Get conversation preferences for a public or private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to get preferences for.

Raises:

  • (ArgumentError)

See Also:



140
141
142
143
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 140

def admin_conversations_getConversationPrefs(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.getConversationPrefs', options)
end

#admin_conversations_getCustomRetention(options = {}) ⇒ Object

This API endpoint can be used by any admin to get a conversation’s retention policy.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (string)

    The conversation to get the retention policy for.

Raises:

  • (ArgumentError)

See Also:



152
153
154
155
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 152

def admin_conversations_getCustomRetention(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.getCustomRetention', options)
end

#admin_conversations_getTeams(options = {}) ⇒ Object

Get all the workspaces a given public or private channel is connected to within this Enterprise org.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to determine connected workspaces within the organization for.

  • :cursor (string)

    Set cursor to next_cursor returned by the previous call to list items in the next page.

  • :limit (integer)

    The maximum number of items to return. Must be between 1 - 1000 both inclusive.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_getTeams(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  if block_given?
    Pagination::Cursor.new(self, :admin_conversations_getTeams, options).each do |page|
      yield page
    end
  else
    post('admin.conversations.getTeams', options)
  end
end

#admin_conversations_invite(options = {}) ⇒ Object

Invite a user to a public or private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel that the users will be invited to.

  • :user_ids (array)

    The users to invite.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_invite(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  raise ArgumentError, 'Required arguments :user_ids missing' if options[:user_ids].nil?
  post('admin.conversations.invite', options)
end

#admin_conversations_lookup(options = {}) ⇒ Object

Returns channels on the given team using the filters.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :last_message_activity_before (integer)

    Filter by public channels where the most recent message was sent before last_message_activity.

  • :team_ids (array)

    Array of team IDs to filter by.

  • :cursor (string)

    Set cursor to next_cursor returned in the previous call, to fetch the next page.

  • :limit (integer)

    Maximum number of results.

  • :max_member_count (integer)

    Filter by public channels with member count equal to or less than the specified number.

Raises:

  • (ArgumentError)

See Also:



209
210
211
212
213
214
215
216
217
218
219
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 209

def admin_conversations_lookup(options = {})
  raise ArgumentError, 'Required arguments :last_message_activity_before missing' if options[:last_message_activity_before].nil?
  raise ArgumentError, 'Required arguments :team_ids missing' if options[:team_ids].nil?
  if block_given?
    Pagination::Cursor.new(self, :admin_conversations_lookup, options).each do |page|
      yield page
    end
  else
    post('admin.conversations.lookup', options)
  end
end

#admin_conversations_removeCustomRetention(options = {}) ⇒ Object

This API endpoint can be used by any admin to remove a conversation’s retention policy.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (string)

    The conversation to set the retention policy for.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_removeCustomRetention(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.removeCustomRetention', options)
end

#admin_conversations_rename(options = {}) ⇒ Object

Rename a public or private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to rename.

  • :name (string)

    .

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_rename(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
  post('admin.conversations.rename', options)
end

#admin_conversations_search(options = {}) ⇒ Object

Search for public or private channels in an Enterprise organization.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :connected_team_ids (array)

    Array of encoded team IDs, signifying the external orgs to search through.

  • :cursor (string)

    Set cursor to next_cursor returned by the previous call to list items in the next page.

  • :limit (integer)

    Maximum number of items to be returned. Must be between 1 - 20 both inclusive. Default is 10.

  • :query (string)

    Name of the the channel to query by.

  • :search_channel_types (array)

    The type of channel to include or exclude in the search. For example private will search private channels, while private_exclude will exclude them. For a full list of types, check the Types section.

  • :sort (string)

    Possible values are relevant (search ranking based on what we think is closest), name (alphabetical), member_count (number of users in the channel), and created (date channel was created). You can optionally pair this with the sort_dir arg to change how it is sorted.

  • :sort_dir (string)

    Sort direction. Possible values are asc for ascending order like (1, 2, 3) or (a, b, c), and desc for descending order like (3, 2, 1) or (c, b, a).

  • :team_ids (array)

    Comma separated string of team IDs, signifying the internal workspaces to search through.

  • :total_count_only (boolean)

    Only return the total_count of channels. Omits channel data and allows access for admins without channel manager permissions.

See Also:



271
272
273
274
275
276
277
278
279
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 271

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

#admin_conversations_setConversationPrefs(options = {}) ⇒ Object

Set the posting permissions for a public or private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (string)

    The channel to set the prefs for.

  • :prefs (string)

    The prefs for this channel in a stringified JSON format.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_setConversationPrefs(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  raise ArgumentError, 'Required arguments :prefs missing' if options[:prefs].nil?
  options = encode_options_as_json(options, %i[prefs])
  post('admin.conversations.setConversationPrefs', options)
end

#admin_conversations_setCustomRetention(options = {}) ⇒ Object

This API endpoint can be used by any admin to set a conversation’s retention policy.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (string)

    The conversation to set the retention policy for.

  • :duration_days (integer)

    The message retention duration in days to set for this conversation.

Raises:

  • (ArgumentError)

See Also:



306
307
308
309
310
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 306

def admin_conversations_setCustomRetention(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  raise ArgumentError, 'Required arguments :duration_days missing' if options[:duration_days].nil?
  post('admin.conversations.setCustomRetention', options)
end

#admin_conversations_setTeams(options = {}) ⇒ Object

Set the workspaces in an Enterprise grid org that connect to a public or private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (string)

    The encoded channel_id to add or remove to workspaces.

  • :org_channel (boolean)

    True if channel has to be converted to an org channel.

  • :target_team_ids (array)

    A comma-separated list of workspaces to which the channel should be shared. Not required if the channel is being shared org-wide.

  • :team_id (Object)

    The workspace to which the channel belongs. Omit this argument if the channel is a cross-workspace shared channel.

Raises:

  • (ArgumentError)

See Also:



325
326
327
328
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 325

def admin_conversations_setTeams(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.setTeams', options)
end

#admin_conversations_unarchive(options = {}) ⇒ Object

Unarchive a public or private channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_id (Object)

    The channel to unarchive.

Raises:

  • (ArgumentError)

See Also:



337
338
339
340
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 337

def admin_conversations_unarchive(options = {})
  raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
  post('admin.conversations.unarchive', options)
end