Closed rahulbot closed 1 year ago
The goal here is to end up with something like a processor.notifications.send_slack_msg
method, with appropriate arguments, that lets us post a msg to a slack channel based on env-vars.
You can build this with a slightly test-driven approach by having a processor.test.test_notifications.test_slack_msg()
method that posts a dummy slack message to a channel that we can verify manually as having posted. Then we integrate it into places where send_email
is used to allow send_slack_msg
to be used in addition or instead.
This should work of off env-vars just like the email one does, returning False
with a warning log if the code tries to use the method but Slack API env-vars are not configured. Ie. a notification failure should not stop regular execution flow of the program.
@adityagurnani22 can you make a PR to get this work integrated into main branch?
completed via #11
Right now, at the end of a nightly cron-triggered data ingestion run we use the
processor.notifications.send_email
helper function to notify people of how many stories, and for which projects, we discovered. The recipient email configuraiton comes from environment variables.This isn't great, because we don't want to receive more barrages of emails. An alternative would be to use the Slack API to post these to a Slack channel, because we use Slack for project coordination. This task involves researching the Slack API, setting up a channel to post updates to, and adding support to post some version of the email text to Slack in addition (based on configured environment variables). Slack offers an SDK that should make the integration easier.