SNS cuts off 2 digits from phone number


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")
    # TODO implement
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
1개 답변

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.

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

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠