diff --git a/app/jobs/puzzle_inventory_check_job.rb b/app/jobs/puzzle_inventory_check_job.rb index f459d8c..e7d0bf0 100644 --- a/app/jobs/puzzle_inventory_check_job.rb +++ b/app/jobs/puzzle_inventory_check_job.rb @@ -16,4 +16,10 @@ def send_low_inventory_notification(count) notification_message = SlackClient::Messages::LowPuzzleInventoryNotification.new(count).create send_message(notification_message, channel_id: ENV.fetch("SHIELD_NOTIFICATIONS_CHANNEL", nil)) end + + def send_message(message, channel_id:) + SlackClient::Client.instance.chat_postMessage(channel: channel_id, blocks: message) + rescue Slack::Web::Api::Errors::SlackError + head :unprocessable_entity + end end