Skip to content

Conversation

@kieran-wilkinson-4
Copy link
Contributor

@kieran-wilkinson-4 kieran-wilkinson-4 commented Feb 2, 2026

Summary

Add notification to Slack when files update in S3

Details

  1. Add new Simple Queue Service (SQS)
    • SQS triggers when the S3 bucket updates
    • 60 second buffer for incoming messages
  2. SQS triggers lambdas
    • syncKnowledgeBaseFunction
    • preprocessingFunction
    • notifyS3UploadFunction (new)
  3. New lambda (notifyS3UploadFunction)
    • Collects any files changed over 60 seconds
    • Sends a message to all private channels it is installed in
  4. Moved syncKnowledgeBaseFunction to handle SQS events
    • S3 events are provided as a "message" inside SQS events

resources: [
props.knowledgeBaseArn,
`arn:aws:ssm:${props.region}:${props.account}:parameter${props.slackBotTokenParameterName}`,
`arn:aws:ssm:${props.region}:${props.account}:parameter${props.slackSigningSecretParameterName}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (non-blocking) these two ARNs are already declared in this file, could make them reusable?

bucket_name = s3_record["s3"].get("bucket", {}).get("name", None)

if bucket_name is None or "-pr-" in bucket_name:
# Ignore PR buckets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: (non-blocking) this comment is a left over, isn't needed anymore


# Skip if no bucket name (e.g., PR buckets)
# PR Lambdas will post to DEV channels
if bucket_name is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought (non-blocking): given the PR noise point you raised, what do you think about gating this behind an env var on the lambda?

default it off for PR stacks to avoid spam, but easy to flip on ad-hoc when we actually want to debug notifications in a PR env

feels like a decent middle ground between DX and not annoying everyone

p.s.: sorry - I know I made you remove the -pr- check earlier today 😅

@bencegadanyi1-nhs bencegadanyi1-nhs enabled auto-merge (squash) February 4, 2026 15:56
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2026

@bencegadanyi1-nhs bencegadanyi1-nhs merged commit 1af73c2 into main Feb 4, 2026
14 checks passed
@bencegadanyi1-nhs bencegadanyi1-nhs deleted the AEA-5931-Add-S3-Notifications branch February 4, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants