Method: Slack::Web::Api::Endpoints::Chat#chat_postMessage
- Defined in:
- lib/slack/web/api/endpoints/chat.rb
#chat_postMessage(options = {}) ⇒ Object
This method posts a message to a public channel, private channel, or direct message/IM channel.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 53 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 must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end post('chat.postMessage', ) end |