SNS sending SMS using SDK for JavaScript (v3)

Suman Dev
Jun 22, 2023
import { SNSClient, PublishCommand } from "@aws-sdk/client-sns";

export const sendSMS = async () => {
try {
const sns = new SNSClient({ region: 'Your AWS Region' });
const params = {
Message: 'Your OTP Message',
PhoneNumber: 'To phone number',
};

const snsReseult = await sns.send(new PublishCommand(params));
return snsReseult
} catch (err) {
throw err;
}
}

For further reference , please look in to this AWS Docs

--

--