module Slack::Endpoint::Chat

Public Instance Methods

chat_delete(options={}) click to toggle source

This method deletes a message from a channel.

@option options [Object] :ts

Timestamp of the message to be deleted.

@option options [Object] :channel

Channel containing the message to be deleted.

@see api.slack.com/methods/chat.delete @see github.com/aki017/slack-api-docs/blob/master/methods/chat.delete.md @see github.com/aki017/slack-api-docs/blob/master/methods/chat.delete.json

# 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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("chat.delete", options)
end
chat_postMessage(options={}) click to toggle source

This method posts a message to a public channel, private group, or IM channel.

@option options [Object] :channel

Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.

@option options [Object] :text

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

@option options [Object] :username

Name of bot.

@option options [Object] :as_user

Pass true to post the message as the authed user, instead of as a bot

@option options [Object] :parse

Change how messages are treated. See below.

@option options [Object] :link_names

Find and link channel names and usernames.

@option options [Object] :attachments

Structured message attachments.

@option options [Object] :unfurl_links

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

@option options [Object] :unfurl_media

Pass false to disable unfurling of media content.

@option options [Object] :icon_url

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

@option options [Object] :icon_emoji

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

@see api.slack.com/methods/chat.postMessage @see github.com/aki017/slack-api-docs/blob/master/methods/chat.postMessage.md @see github.com/aki017/slack-api-docs/blob/master/methods/chat.postMessage.json

# File lib/slack/endpoint/chat.rb, line 51
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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("chat.postMessage", options)
end
chat_update(options={}) click to toggle source

This method updates a message in a channel.

@option options [Object] :ts

Timestamp of the message to be updated.

@option options [Object] :channel

Channel containing the message to be updated.

@option options [Object] :text

New text for the message, using the default formatting rules.

@option options [Object] :attachments

Structured message attachments.

@option options [Object] :parse

Change how messages are treated. See below.

@option options [Object] :link_names

Find and link channel names and usernames.

@see api.slack.com/methods/chat.update @see github.com/aki017/slack-api-docs/blob/master/methods/chat.update.md @see github.com/aki017/slack-api-docs/blob/master/methods/chat.update.json

# File lib/slack/endpoint/chat.rb, line 76
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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("chat.update", options)
end