SNS cuts off 2 digits from phone number

0

I'm trying to send text messages via lambda using boto3 sns client. Some messages to through fine but I can see from sns-console that some destination phone numbers are cut short. For example I'm trying to send message to phonenumber "+358501234567". In sns consoles delivery status logs I see that my "destination phone number" is 3585012345. Why does this happen? These messages fail and logs give me the following error: "Unknown error attempting to reach phone"

import json
import boto3

def lambda_handler(event, context):
    sns = boto3.client('sns')
    msgdata = sns.publish(PhoneNumber = "+358XXXXXXX", Message = "Test", Subject = "Alert")
    print(msgdata)
    # TODO implement
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
    }
已提問 2 年前檢視次數 253 次
1 個回答
0

Dear AWS-User-60837578,

While we where not directly able to reproduce your issue, here are our best attempt suggestions to help you resolve your issue:

  1. Ensure that the number you are trying to reach is valid: SNS follows the E.164, which is an international standards for phone addressing. Standard subscriber numbers are limited to 12 digits.
  2. Ensure your code allows for the maximum possible range of numbers. The given number in your question is longer than the example listed in the code. If you are using some kind of string replacement, it is possible your characters are being left behind there.

Our guide to pushing to mobile phone numbers is here bellow. This includes code samples that utilize our best practices. https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html

Hopefully this helps you solve the issue. We are always happy to respond if you have further questions!

Issac_A
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南