Skip to content

Commit c00c22a

Browse files
authored
Merge pull request #21 from fastruby/fix-slack-notification
Add missing send_message method to puzzle inventory job
2 parents 3573d52 + 5bf016e commit c00c22a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/jobs/puzzle_inventory_check_job.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ def send_low_inventory_notification(count)
1616
notification_message = SlackClient::Messages::LowPuzzleInventoryNotification.new(count).create
1717
send_message(notification_message, channel_id: ENV.fetch("SHIELD_NOTIFICATIONS_CHANNEL", nil))
1818
end
19+
20+
def send_message(message, channel_id:)
21+
SlackClient::Client.instance.chat_postMessage(channel: channel_id, blocks: message)
22+
rescue Slack::Web::Api::Errors::SlackError
23+
head :unprocessable_entity
24+
end
1925
end

0 commit comments

Comments
 (0)