Implementing an AWS Lambda function that sends me an email upon successful user sign-up verification is what I'm trying to do. The issue is that while I receive an email when I test the lambda function, when I add the lambda trigger for "Post Confirmation," the mail is instead delivered to the individual who joins up. I think I made myself clear; this is where the Lambda function is:
import json
import boto3
def lambda_handler(event, context):
client = boto3.client("sns")
message = {
"eventName": "newUser",
"email": event["request"]["userAttributes"]["email"],
"name": event["request"]["userAttributes"]["name"],
"sub": event["request"]["userAttributes"]["sub"]
}
response = client.publish(
TopicArn="arnfortheawssns",
Message=json.dumps(message)
)
# TODO implement
return {
'statusCode': 200,
'body': json.dumps(response)
}
Since I received the notice email in tests, I am confident that I am using the correct ARN.
I'm combining SNS, Cognito, and AWS Lambda. I attempted to get an email notification whenever a user signs up, but the user who signs up gets the email instead of me.