-
-
Save KyMidd/0e7b25349cbcca0f85d3eae1befc81a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def handle_teams_event(body, event): | |
| # Identify event_type | |
| event_type = body.get("type", "") | |
| # Only process events we care about | |
| if event_type == 'message': | |
| print("🟢 Event type:", event_type) | |
| # Read table names from environment variables | |
| conversation_table_arn = os.environ.get("CONVERSATION_TABLE_ARN") | |
| token_table_arn = os.environ.get("TOKEN_TABLE_ARN") | |
| # Check for existing valid token | |
| dynamodb_client = boto3.client("dynamodb") | |
| # Get AAD ID from event | |
| aadObjectId = body.get("from", {}).get("aadObjectId", "") | |
| if not aadObjectId: | |
| print("🚫 No AAD ID found in event, exiting") | |
| return | |
| # Check if existing token. If not, send user card to send to authentication | |
| # Token is base64 encoded and also encrypted with a CMK key | |
| encrypted_token = get_token(dynamodb_client, aadObjectId, token_table_arn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment