Module: Slack::Endpoint::Chat
- Included in:
- Slack::Endpoint
- Defined in:
- lib/slack/endpoint/chat.rb
Instance Method Summary collapse
-
#chat_delete(options = {}) ⇒ Object
This method deletes a message from a channel.
-
#chat_meMessage(options = {}) ⇒ Object
This method sends a me message to a channel from the calling user.
-
#chat_postMessage(options = {}) ⇒ Object
This method posts a message to a public channel, private channel, or direct message/IM channel.
-
#chat_unfurl(options = {}) ⇒ Object
This method attaches Slack app unfurl behavior to a specified and relevant message.
-
#chat_update(options = {}) ⇒ Object
This method updates a message in a channel.
Instance Method Details
#chat_delete(options = {}) ⇒ Object
This method deletes a message from a channel.
18 19 20 21 22 |
# File 'lib/slack/endpoint/chat.rb', line 18 def chat_delete(={}) throw ArgumentError.new("Required arguments :ts missing") if [:ts].nil? throw ArgumentError.new("Required arguments :channel missing") if [:channel].nil? post("chat.delete", ) end |
#chat_meMessage(options = {}) ⇒ Object
This method sends a me message to a channel from the calling user.
34 35 36 37 38 |
# File 'lib/slack/endpoint/chat.rb', line 34 def chat_meMessage(={}) throw ArgumentError.new("Required arguments :channel missing") if [:channel].nil? throw ArgumentError.new("Required arguments :text missing") if [:text].nil? post("chat.meMessage", ) end |
#chat_postMessage(options = {}) ⇒ Object
This method posts a message to a public channel, private channel, or direct message/IM channel.
72 73 74 75 76 77 |
# File 'lib/slack/endpoint/chat.rb', line 72 def chat_postMessage(={}) throw ArgumentError.new("Required arguments :channel missing") if [:channel].nil? throw ArgumentError.new("Required arguments :text or :attachments missing") if [:text].nil? && [:attachments].nil? [:attachments] = [:attachments].to_json if [:attachments].is_a?(Array) || [:attachments].is_a?(Hash) post("chat.postMessage", ) end |
#chat_unfurl(options = {}) ⇒ Object
This method attaches Slack app unfurl behavior to a specified and relevant message. A user token is required as this method does not support bot user tokens.
93 94 95 96 97 98 |
# File 'lib/slack/endpoint/chat.rb', line 93 def chat_unfurl(={}) throw ArgumentError.new("Required arguments :channel missing") if [:channel].nil? throw ArgumentError.new("Required arguments :ts missing") if [:ts].nil? throw ArgumentError.new("Required arguments :unfurls missing") if [:unfurls].nil? post("chat.unfurl", ) end |
#chat_update(options = {}) ⇒ Object
This method updates a message in a channel. Though related to chat.postMessage, some parameters of chat.update are handled differently.
120 121 122 123 124 125 126 |
# File 'lib/slack/endpoint/chat.rb', line 120 def chat_update(={}) throw ArgumentError.new("Required arguments :ts missing") if [:ts].nil? throw ArgumentError.new("Required arguments :channel missing") if [:channel].nil? throw ArgumentError.new("Required arguments :text missing") if [:text].nil? [:attachments] = [:attachments].to_json if [:attachments].is_a?(Array) || [:attachments].is_a?(Hash) post("chat.update", ) end |