/CustomSmsSender

AWS Cognito 3rd party SMS integration using lambda.

Primary LanguageJavaScript

Custom SMS Sender

JavaScript
AWS Cloud

This repository is to send OTP to the cognito user using 3rd party Spring Edge SMS service provider

Custom SMS sender Lambda trigger sources

TriggerSource value

Triggering event

CustomSMSSender_SignUp

A user signs up and Amazon Cognito sends a welcome message.

CustomSMSSender_ForgotPassword

A user requests a code to reset their password.

CustomSMSSender_ResendCode

A user requests a replacement code to reset their password.

CustomSMSSender_VerifyUserAttribute

A user creates a new email address or phone number attribute and Amazon Cognito sends a code to verify the attribute.

CustomSMSSender_UpdateUserAttribute

A user updates an email address or phone number attribute and Amazon Cognito sends a code to verify the attribute.

CustomSMSSender_Authentication

A user configured with SMS multi-factor authentication (MFA) signs in.

CustomSMSSender_AdminCreateUser

You create a new user in your user pool and Amazon Cognito sends them a temporary password.

Environment Variables

  1. Set the following enviroment variables after uploading .zip file into lambda

    • KEY_ID - KMS ARN

    • apikey - Spring Edge/3rd Party SMS service provider API KEY

    • sender - Sender SMS Header (In India, DLT approval is must) --------------------E-mail Config---------------

    • Region - From which region AWS SES sending E-Mail

    • sender_email -

    • email_signup_template -

    • email_verify_template -

    • email_forgot_password_template -

    • reply_email -

Deploy

  • Run the following command to install all the dependencies

  • Make sure the lambda has permission to invoke SES

npm install
  • Create a .zip file by selecting all the files or by adding the index.js and node_modules folder in a zip & directories inside the project.

  • Upload the .zip file to lambda / AWS S3.

Test