Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created January 13, 2025 04:05
Show Gist options
  • Select an option

  • Save KyMidd/7cdd0fcb24b8e62e797c44663dc5efef to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/7cdd0fcb24b8e62e797c44663dc5efef to your computer and use it in GitHub Desktop.
def lambda_handler(event, context):
print("πŸš€ Lambda execution starting")
# Isolate body
event_body = isolate_event_body(event)
# Check for duplicate event or trash messages, return 200 and exit if detected
if check_for_duplicate_event(event["headers"], event_body["event"]):
return generate_response(
200, "❌ Detected a re-send or edited message, exiting"
)
# Special challenge event for Slack. If receive a challenge request, immediately return the challenge
if "challenge" in event_body:
return {
"statusCode": 200,
"body": json.dumps({"challenge": event_body["challenge"]}),
}
# Print the event
print("πŸš€ Event:", event)
# Fetch secret package
secrets = get_secret_ssm_layer(bot_secret_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment