async function sendAlert()

in amplify/backend/function/smartshelf72d32494/src/index.js [17:30]


async function sendAlert(bottleCount, _threshold) {
  try {
    const data = await sns.send(
      new PublishCommand({
        TopicArn: process.env.SNS_TOPIC,
        Message: `Only ${bottleCount} bottle(s) left in shelf which is less than threshold you defined. Please refill as soon as possible.`,
        Subject: "Out of Stock Notification",
      })
    );
    console.log("Alert sent successfully!", data);
  } catch (err) {
    console.error("Error sending alert", err);
  }
}