if (resp.status_code != 200):
app.logger.error("Error posting request to Slack: " + resp.text)
else:
- try:
- slack_client.chat_postMessage(channel=channel, text=text)
- except SlackApiError as e:
- app.logger.error("Slack API error: " + e.response["error"])
+ slack_send_message(channel, text)
+
+def slack_send_message(channel, text):
+ """Send a Slack message to a specified channel."""
+
+ slack_client.chat_postMessage(channel=channel, text=text)
+