Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMS not being sent #32

Closed
diegoaguilar opened this issue Feb 29, 2016 · 6 comments
Closed

SMS not being sent #32

diegoaguilar opened this issue Feb 29, 2016 · 6 comments

Comments

@diegoaguilar
Copy link

So, I have credits in my nexmo account, I'm trying to send an SMS and with debug mode on, I can see:

sending message from NEXMO to +521222205xxxx with message Nexmo - rollbar winston test
{ host: 'rest.nexmo.com',
  port: 80,
  path: '/sms/json?&api_key=a8xxxxxx&api_secret=85xxxxxx',
  method: 'POST',
  headers:
   { 'Content-Type': 'application/x-www-form-urlencoded',
     accept: 'application/json',
     'Content-Length': 0 } }
response ended

I've confirmed the api key and the api secret, but any SMS is being sent. Suggestions?

@pvela
Copy link
Contributor

pvela commented Mar 1, 2016

What "FROM" number are you using to send this message?

Some of the constraints to be aware of :

New accounts can only send to numbers that have been verified in the dashboard, and 'Nexmo Demo' will be added to all messages. Once you've added funds to your account, those restrictions will be removed.

@diegoaguilar
Copy link
Author

Well I'm using a placeholder text as the "FROM" number, and eventhough I've not purchased any numbers, I've already bought credits.

I achieved sending SMS with this code:

function requestSMS(key, secret, text, from, to, options) {
  options = options || {};
  var post = {
    api_key: key,
    api_secret: secret,
    from: from,
    to: to,
    text: text.toString(),
  };
  if (options.debug) {
      winston.debug('About to send SMS from % to %', from, to);
      winston.debug(post);
  }

  request.post(
    'https://rest.nexmo.com/sms/json',
    { form: post },
    (err, httpResponse, body) => {
    if (err && options.debug) {
      winston.debug('Request to send SMS failed');
      winston.debug(err);
    } else if (options.debug) {
      winston.debug(body);
    }
  });
}

@pvela
Copy link
Contributor

pvela commented Mar 2, 2016

Are you saying that you were able to send a message using the direct API call and its not working with the NPM package easynexmo with the same set of parameters (key, secret, from and to)?

@diegoaguilar
Copy link
Author

Yep, exactly that :(
On Mar 2, 2016 12:29 AM, "prabhu" notifications@github.com wrote:

Are you saying that you were able to send a message using the direct API
call and its not working with the NPM package easynexmo with the same set
of parameters (key, secret, from and to)?


Reply to this email directly or view it on GitHub
#32 (comment).

@diegoaguilar
Copy link
Author

@pvela any opinions or suggestions?

@pvela
Copy link
Contributor

pvela commented Mar 17, 2016

@diegoaguilar Tried many times but couldn't replicate the problem. After taking a closer look at your output from the initial paste it looks like you are connecting to port 80, which is not the correct port to connect to. Can you verify if you are using the latest version of the library and check if you have overwritten the port from 443 to 80.

@pvela pvela closed this as completed Apr 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants