Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
375 stars 178 forks source link

Basic setup of SMS api is not working, I get status 0 (success) but no sms sent. #790

Closed spyshower closed 1 year ago

spyshower commented 1 year ago

What the title says.

Current Behavior

The thing is that I can send sms in the dashboard to my personal phone number, but when I use the node sdk to send to this exact number I get a success response but no actual sms arrives.

The api key & secret are correct.

Steps to Reproduce (for bugs)

I only did the basic setup. Code:

exports.sendSms = async ({ to, text }) => {
  const from = "Delivery Man";

  to --> [countryCode][phoneNumber] eg: 45XXXXXXXXXX
  text --> dasdas

  for (const phone of to) {
    await vonage.sms
      .send({ to: `${phone}`, from, text })
      .then((res) => console.log("ok ", res))
      .catch((err) => console.log("sms err: ", err, err.response.messages));
  }
};

Response:

{
  messageCount: 1,
  'message-count': '1',
  messages: [
    {
      to: 'mynumber',
      'message-id': 'df850934-0ca9-45c0-b432-4fad29463d4b',
      status: '0',
      'remaining-balance': '2.42000000',
      'message-price': '0.04930000',
      network: '20201',
      messageId: 'df850934-0ca9-45c0-b432-4fad29463d4b',
      remainingBalance: '2.42000000',
      messagePrice: '0.04930000'
    }
  ]
}

Logs:

Screenshot 2023-01-30 at 10 55 52

Context

Your Environment

manchuck commented 1 year ago

@spyshower Sending SMS messages is an async process. After sending the message to the API, our servers will handle passing the message to the telecom. A status code of 0 means that the endpoint accepted the message. You got an error message of 10 based on the screenshot. There was an issue with the content of the message, you should check with support for more information.

spyshower commented 1 year ago

@spyshower Sending SMS messages is an async process. After sending the message to the API, our servers will handle passing the message to the telecom. A status code of 0 means that the endpoint accepted the message. You got an error message of 10 based on the screenshot. There was an issue with the content of the message, you should check with support for more information.

@manchuck hmm, I use some random text like "dasdas", how can there be a problem with that? :P

manchuck commented 1 year ago

You could try changing the message around but I would contact support. They can provide more information on that specific message. There are too many ways for the message to be rejected.