module Slack::Web::Im
Module for the im methods. Get info on your direct messages.
Constants
- SCOPE
Endpoint scope
Public Instance Methods
Close a direct message channel.
@param [Hash] params
API call arguments
@option params [im] 'channel'
Direct message channel to close.
@see api.slack.com/methods/im.close
# File lib/slack/web/im.rb, line 20 def im_close(params = {}) fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil? response = @session.do_post "#{SCOPE}.close", params Slack.parse_response(response) end
Fetches history of messages and events from direct message channel.
@param [Hash] params
API call arguments
@option params [im] 'channel'
Direct message channel to fetch history for.
@option params [timestamp] 'latest'
Latest message timestamp to include in results.
@option params [timestamp] 'oldest'
Oldest message timestamp to include in results.
@option params [Object] 'inclusive'
Include messages with latest or oldest timestamp in results.
@option params [Object] 'count'
Number of messages to return, between 1 and 1000.
@see api.slack.com/methods/im.history
# File lib/slack/web/im.rb, line 42 def im_history(params = {}) fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil? response = @session.do_post "#{SCOPE}.history", params Slack.parse_response(response) end
Lists direct message channels for the calling user.
@param [Hash] params
API call arguments
@see api.slack.com/methods/im.list
# File lib/slack/web/im.rb, line 54 def im_list(params = {}) response = @session.do_post "#{SCOPE}.list", params Slack.parse_response(response) end
Sets the read cursor in a direct message channel.
@param [Hash] params
API call arguments
@option params [im] 'channel'
Direct message channel to set reading cursor in.
@option params [timestamp] 'ts'
Timestamp of the most recently seen message.
@see api.slack.com/methods/im.mark
# File lib/slack/web/im.rb, line 69 def im_mark(params = {}) fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil? fail ArgumentError, "Required arguments 'ts' missing" if params['ts'].nil? response = @session.do_post "#{SCOPE}.mark", params Slack.parse_response(response) end
Opens a direct message channel.
@param [Hash] params
API call arguments
@option params [user] 'user'
User to open a direct message channel with.
@see api.slack.com/methods/im.open
# File lib/slack/web/im.rb, line 84 def im_open(params = {}) fail ArgumentError, "Required arguments 'user' missing" if params['user'].nil? response = @session.do_post "#{SCOPE}.open", params Slack.parse_response(response) end