Search code examples
node.jsamazon-web-servicesamazon-snsttl

How to set the TTL attribute in the publish method of SNS in NodeJS?


I'm writing code to send an OTP message. My current parameters and publish method look as follows:

params = {
  Message: otpMessage,
  MessageStructure: 'string',
  PhoneNumber: contactNo
};

sns.publish(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else console.log(data);           // successful response
});

How do I set the TTL attribute?


Solution

  • It appears you would like to set TTL attribute when sending OTP messages but currently Amazon SNS does not support setting TTL for any of the following :

    • SMS
    • SQS
    • HTTP
    • email.

    TTL is only applicable when sending mobile push notification using any of the following platform :

    • APNS
    • APNS_Sandbox

    • FCM

    • ADM

    • Baidu

    • WNS