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):

  • :target_team_id (string)

    Target team ID.

  • :channel_ids (array)

    An array of channel IDs.

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 :target_team_id missing' if options[:target_team_id].nil?
  raise ArgumentError, 'Required arguments :channel_ids missing' if options[:channel_ids].nil?
  post('admin.conversations.bulkMove', options)
end

#admin_conversations_bulkSetExcludeFromSlackAi(options = {}) ⇒ Object

Exclude channels from Slack AI in bulk

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel_ids (array)

    An array of channel IDs to exclude from Slack AI.

  • :exclude (boolean)

    Whether the channels should be excluded from Slack AI.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_bulkSetExcludeFromSlackAi(options = {})
  raise ArgumentError, 'Required arguments :channel_ids missing' if options[:channel_ids].nil?
  raise ArgumentError, 'Required arguments :exclude missing' if options[:exclude].nil?
  post('admin.conversations.bulkSetExcludeFromSlackAi', 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:



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

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:



96
97
98
99
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 96

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):

  • :name (string)

    Name of the public or private channel to create.

  • :description (string)

    Description of the public or private channel to create.

  • :is_private (boolean)

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

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



116
117
118
119
120
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 116

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

#admin_conversations_createForObjects(options = {}) ⇒ Object

Create a Salesforce channel for the corresponding object provided.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :object_id (string)

    Object / Record ID (15 or 18 digit accepted). See here for how to look up an ID.

  • :salesforce_org_id (string)

    Salesforce org ID (15 or 18 digit accepted). See here for how to look up Salesforce org ID.

  • :invite_object_team (boolean)

    Optional flag to add all team members related to the object to the newly created Salesforce channel. When true, adds a maximum of 100 team members to the channel.

Raises:

  • (ArgumentError)

See Also:



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

def admin_conversations_createForObjects(options = {})
  raise ArgumentError, 'Required arguments :object_id missing' if options[:object_id].nil?
  raise ArgumentError, 'Required arguments :salesforce_org_id missing' if options[:salesforce_org_id].nil?
  post('admin.conversations.createForObjects', 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:



146
147
148
149
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 146

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)

    Used for disconnecting a team from a shared channel. Only one team ID may be passed at a time.

Raises:

  • (ArgumentError)

See Also:



160
161
162
163
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 160

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:



172
173
174
175
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 172

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:



184
185
186
187
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 184

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:



200
201
202
203
204
205
206
207
208
209
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 200

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):

  • :user_ids (array)

    The users to invite.

  • :channel_id (Object)

    The channel that the users will be invited to.

Raises:

  • (ArgumentError)

See Also:



220
221
222
223
224
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 220

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

#admin_conversations_linkObjects(options = {}) ⇒ Object

Link a Salesforce record to a channel

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel ID for Slack channel that will be linked to a Salesforce record.

  • :record_id (string)

    Salesforce record ID (15 or 18 digit accepted). See here for how to look up record ID.

  • :salesforce_org_id (string)

    Salesforce org ID (15 or 18 digit accepted). See here for how to look up Salesforce org ID.

Raises:

  • (ArgumentError)

See Also:



237
238
239
240
241
242
243
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 237

def admin_conversations_linkObjects(options = {})
  raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
  raise ArgumentError, 'Required arguments :record_id missing' if options[:record_id].nil?
  raise ArgumentError, 'Required arguments :salesforce_org_id missing' if options[:salesforce_org_id].nil?
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  post('admin.conversations.linkObjects', 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):

  • :team_ids (array)

    Array of team IDs to filter by.

  • :max_member_count (integer)

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

  • :last_message_activity_before (integer)

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

  • :cursor (string)

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

  • :limit (integer)

    Maximum number of results.

Raises:

  • (ArgumentError)

See Also:



260
261
262
263
264
265
266
267
268
269
270
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 260

def admin_conversations_lookup(options = {})
  raise ArgumentError, 'Required arguments :team_ids missing' if options[:team_ids].nil?
  raise ArgumentError, 'Required arguments :last_message_activity_before missing' if options[:last_message_activity_before].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:



279
280
281
282
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 279

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:



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

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):

  • :team_ids (array)

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

  • :connected_team_ids (array)

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

  • :query (string)

    Name of the the channel to query by.

  • :limit (integer)

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

  • :cursor (string)

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

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

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



321
322
323
324
325
326
327
328
329
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 321

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:



340
341
342
343
344
345
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 340

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:



356
357
358
359
360
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 356

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

  • :team_id (Object)

    The workspace to which the channel belongs if the channel is a local workspace channel. Omit this argument if the channel is a cross-workspace or org-wide shared 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.

  • :org_channel (boolean)

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

Raises:

  • (ArgumentError)

See Also:



375
376
377
378
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 375

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:



387
388
389
390
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 387

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

#admin_conversations_unlinkObjects(options = {}) ⇒ Object

Unlink a Salesforce record from a channel

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel ID for Slack channel that will be unlinked from the Salesforce record.

  • :new_name (string)

    Channel name you would like to give to the channel that is being unlinked from the Salesforce record.

Raises:

  • (ArgumentError)

See Also:



401
402
403
404
405
406
# File 'lib/slack/web/api/endpoints/admin_conversations.rb', line 401

def admin_conversations_unlinkObjects(options = {})
  raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
  raise ArgumentError, 'Required arguments :new_name missing' if options[:new_name].nil?
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  post('admin.conversations.unlinkObjects', options)
end