module Slack::Web::Api::Endpoints::Im

Public Instance Methods

im_close(options = {}) click to toggle source

This method closes a direct message channel.

@option options [im] :channel

Direct message channel to close.

@see api.slack.com/methods/im.close @see github.com/dblock/slack-api-ref/blob/master/methods/im.close.json

# File lib/slack/web/api/endpoints/im.rb, line 15
def im_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('im.close', options)
end
im_history(options = {}) click to toggle source

This method returns a portion of messages/events from the specified direct message channel. To read the entire history for a direct message channel, call the method with no latest or oldest arguments, and then continue paging using the instructions below.

@option options [im] :channel

Direct message channel to fetch history for.

@option options [timestamp] :latest

End of time range of messages to include in results.

@option options [timestamp] :oldest

Start of time range of messages to include in results.

@option options [Object] :inclusive

Include messages with latest or oldest timestamp in results.

@option options [Object] :unreads

Include unread_count_display in the output?.

@see api.slack.com/methods/im.history @see github.com/dblock/slack-api-ref/blob/master/methods/im.history.json

# File lib/slack/web/api/endpoints/im.rb, line 38
def im_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]
  post('im.history', options)
end
im_list(options = {}) click to toggle source

This method returns a list of all im channels that the user has.

@see api.slack.com/methods/im.list @see github.com/dblock/slack-api-ref/blob/master/methods/im.list.json

# File lib/slack/web/api/endpoints/im.rb, line 49
def im_list(options = {})
  post('im.list', options)
end
im_mark(options = {}) click to toggle source

This method moves the read cursor in a direct message channel.

@option options [im] :channel

Direct message channel to set reading cursor in.

@option options [timestamp] :ts

Timestamp of the most recently seen message.

@see api.slack.com/methods/im.mark @see github.com/dblock/slack-api-ref/blob/master/methods/im.mark.json

# File lib/slack/web/api/endpoints/im.rb, line 62
def im_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: channels_id(options)['channel']['id']) if options[:channel]
  post('im.mark', options)
end
im_open(options = {}) click to toggle source

This method opens a direct message channel with another member of your Slack team.

@option options [user] :user

User to open a direct message channel with.

@see api.slack.com/methods/im.open @see github.com/dblock/slack-api-ref/blob/master/methods/im.open.json

# File lib/slack/web/api/endpoints/im.rb, line 76
def im_open(options = {})
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
  post('im.open', options)
end