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

AWS SNS - Message missing a phone number


i'm a web developper and i'm using amazon sns to send sms to my client when the make a reservation on my website. In the message i add a way to contact me back if they want to cancel the reservation with a phone number. I currently have an issue where the phone number don't show up in the final sms.

I'm using node to send the sms

new AWS.SNS({apiVersion: '2010–03–31'}).publish(params).promise()
    .then(async message => {
        console.log("OTP SEND SUCCESS");
          entite.createSendedMessage({
              numeroSms: number, // Replace with the actual values for your SendedSms
              messageSms: mess,
              messageStatus: 1
          });
         return res.status(201).send({
            "status": true, message: 'SMS envoyé'
        });
    })
    .catch(err => {
        entite.createSendedMessage({
            numeroSms: number, // Replace with the actual values for your SendedSms
            messageSms: mess,
            messageStatus: -1,
            awsError: err.toString()
        });
        console.log("Error "+err)
        return res.status(500).send({
            "status": false,
            message: 'SMS non envoyé',
            error:err.toString()
        });

    });

I try to sending a sms to my phone it work properly, and i have try on other phone and number is cut off.

This is the kind of message i will be sending with my api :

{
"number":"+33700000000",
"message":"Votre réservation de bateau électrique (demain à 14h) chez Alize Location est confirmée. Soyez à l'heure. En cas d'annulation, contactez le 0400000000"
}

And the response :

{
"status": true,
"message": "SMS envoyé"
}

Solution

  • I experienced the same issue and contacted the AWS support team, but unfortunately, they weren’t able to help.

    I conducted a series of tests myself, and in my case, it was just the message length. Some carriers truncate messages if they are too long, even if it’s the correct number of characters for Amazon. In some countries, carriers allow fewer characters…

    Please try removing some words/characters from your message to see if it’s still being truncated.