Module: Slack::Endpoint::Chat

Included in:
Slack::Endpoint
Defined in:
lib/slack/endpoint/chat.rb

Instance Method Summary collapse

Instance Method Details

#chat_delete(options = {}) ⇒ Object

Deletes a message.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :ts (Object)

    Timestamp of the message to be deleted.

  • :channel (channel)

    Channel containing the message to be deleted.

See Also:



16
17
18
19
20
# File 'lib/slack/endpoint/chat.rb', line 16

def chat_delete(options={})
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  post("chat.delete", options)
end

#chat_postMessage(options = {}) ⇒ Object

Sends a message to a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.

  • :text (Object)

    Text of the message to send. See below for an explanation of formatting.

  • :username (Object)

    Name of bot.

  • :parse (Object)

    Change how messages are treated. See below.

  • :link_names (Object)

    Find and link channel names and usernames.

  • :attachments (Object)

    Structured message attachments.

  • :unfurl_links (Object)

    Pass true to enable unfurling of primarily text-based content.

  • :unfurl_media (Object)

    Pass false to disable unfurling of media content.

  • :icon_url (Object)

    URL to an image to use as the icon for this message

  • :icon_emoji (Object)

    emoji to use as the icon for this message. Overrides ‘icon_url`.

See Also:



48
49
50
51
52
# File 'lib/slack/endpoint/chat.rb', line 48

def chat_postMessage(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
  post("chat.postMessage", options)
end

#chat_update(options = {}) ⇒ Object

Updates a message.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :ts (Object)

    Timestamp of the message to be updated.

  • :channel (channel)

    Channel containing the message to be updated.

  • :text (Object)

    New text for the message, using the [default formatting rules](/docs/formatting).

See Also:



66
67
68
69
70
71
# File 'lib/slack/endpoint/chat.rb', line 66

def chat_update(options={})
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
  post("chat.update", options)
end