Lambda inserting into SQS using message timer

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SQS.html#sendMessage-property

const AWS = require('aws-sdk');

exports.handler = async (event, context) => {
  // Get the SQS client.
  const sqs = new AWS.SQS({
    region: process.env.AWS_REGION,
  });

  // Get the SQS queue URL.
  const queueUrl = process.env.QUEUE_URL;

  //set delay to 5 seconds
  let delay=5;

  // Get the message body.
  const messageBody = event.messageBody;

  // Create the SQS message.
  // Note message Body must be a string
  const message = {
    MessageBody: messageBody,
  };


  // Send the SQS message.
  const sendMessageResult = await sqs.sendMessage({
    QueueUrl: queueUrl,
    Message: message,
    DelaySeconds: delay.toString()
  });

  // Return the SQS message ID.
  return sendMessageResult.MessageId;
};

This code uses the aws-sdk Node.js module to interact with AWS services. The first line imports the module. The next line creates a new SQS client. The queueUrl variable is set to the ARN of the SQS queue that you want to insert the message into. The messageBody variable is set to the body of the message that you want to insert.

The messageTimer object is created with the DelaySeconds property. This property specifies the number of seconds to wait before the message is sent to the SQS queue.

The sendMessageResult object is returned from the sendMessage() method. This object contains the ID of the SQS message that was sent.

You can customize this example to fit your specific needs. For example, you can use a different SQS queue or you can send a different message body.