AWS Cognito that triggers Lambda function and sends me a notification when a new user signs up using SNS

0 votes

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.

Jan 19, 2023 in AWS by Lakhbir
• 100 points

edited 4 days ago 7 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP