0

Does Aws has feature to send failed sms messages to dead letter queue without using topic and subscriptions.

I know with using topic and subscription we can attach the dlq in redrive policy in subscription and then sns send the failed delivered messages to dlq by default.

But I am using aws lambda function consuming sns boto3 client and publishing SMS directly to phone number coming from my api gateway rather using topicarn.

I can’t find anyway to get the failed messages in dead letter queue in this scenario.

Requesting a quick help here.

response=sns_client.publish(PhoneNumber=number,
            Message=sms_message, 
            MessageAttributes={'AWS.SNS.SMS.SenderID': {'DataType': 'String', 'StringValue': sender_id}, 
           'AWS.SNS.SMS.SMSType': {'DataType': 'String', 'StringValue': 'Transactional'}}
  • If you want information about SMS delivery, you could use [Access Amazon SNS topic delivery logs for SMS messages](https://aws.amazon.com/premiumsupport/knowledge-center/monitor-sns-texts-cloudwatch/). I think it works for messages sent _directly_ (not via a Topic) too. – John Rotenstein Jul 25 '21 at 23:09
  • Thanks Jhon, is that not any way it can be send these to dead letterqueue in case of failure, like it happens with topic and subscription. – Nitesh Kumar Jul 26 '21 at 03:38
  • I do not think that is possible. – John Rotenstein Jul 26 '21 at 03:49
  • Thanks Jhon, have pasted code as well in my question. currently the sms are getting failed as i can see on my dashboard but these are not going in dead letter queue. but if i will use topicarn instead of direct phone number and will subscribe my topic with SMS protocol and attach the redrive policy as DLQ it will go to DLQ as soon as message fails. any custom solution you have so that i can send failed messages to DLQ? – Nitesh Kumar Jul 26 '21 at 04:41
  • If you send messages to single users each time, it would not be appropriate to use an SNS Topic. The better approach would be to send the SMS directly, then search the Delivery Logs to find any errors. – John Rotenstein Jul 26 '21 at 05:36
  • Hi John, Sorry i am new to AWS. I am not using topic as i need to send SMS to one user as per the request coming through my API. so the Phone number will be changed every time. – Nitesh Kumar Jul 26 '21 at 06:23
  • Yes, that is correct. You would need to search the Delivery Logs to find any errors. That functionality needs to be activated before use. – John Rotenstein Jul 26 '21 at 07:02

0 Answers0