diff –git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb index 846126e..0c254c6 100644 — a/lib/slack/web/api/endpoints/chat.rb +++ b/lib/slack/web/api/endpoints/chat.rb @@ -62,6 +62,12 @@ module Slack

throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
options = options.merge(user: users_id(options)['user']['id']) if options[:user]

+ # attachments must be passed as an encoded JSON string + if options.key?(:attachments) + attachments = options + attachments = JSON.dump(attachments) unless attachments.is_a?(String) + options = options.merge(attachments: attachments) + end

  post('chat.postEphemeral', options)
end