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 年前269 查看次数
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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则