Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created July 9, 2025 02:29
Show Gist options
  • Select an option

  • Save KyMidd/285f0cdbe1266f95ec2fa396aa8aed77 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/285f0cdbe1266f95ec2fa396aa8aed77 to your computer and use it in GitHub Desktop.
def handle_teams_event(body, event):
# ...
encrypted_token = get_token(dynamodb_client, aadObjectId, token_table_arn)
# If unexpired token is found, send it to the processor lambda
if encrypted_token:
# Initialize AWS Lambda client
lambda_client = boto3.client('lambda')
# Prepare the event to send to the processor lambda
# Add the token to the event
event["token"] = encrypted_token
# Asynchronously invoke the processor Lambda
lambda_client.invoke(
FunctionName=os.environ['WORKER_LAMBDA_NAME'],
InvocationType='Event', # Async invocation
Payload=json.dumps(event)
)
# Return
print("🟢 Successfully invoked the processor Lambda with the access token")
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment