Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

Passing in a client object to send SMS does not work #8

Closed
nguyer opened this issue May 5, 2015 · 6 comments
Closed

Passing in a client object to send SMS does not work #8

nguyer opened this issue May 5, 2015 · 6 comments

Comments

@nguyer
Copy link
Contributor

nguyer commented May 5, 2015

The README.md states that one should be able to create a client object and pass it into any of the methods to make API calls like this:

var client = new catapult.Client("userId", "apiToken", "apiSecret");
catapult.Message.create(client, {from: "+19195551212", to: "+191955512142", text: "Test"}, function(err, message){...});

This does not work. Only using the global client object, does sending SMS actually work.

@avbel
Copy link
Contributor

avbel commented May 6, 2015

I have tested.

    var catapult = require("node-bandwidth");
    catapult.Client.globalOptions.userId = "u-xxxxx";
    catapult.Client.globalOptions.apiToken = "t-xxxxx";
    catapult.Client.globalOptions.apiSecret = "xxxxxx";
    catapult.Message.create( {to: "+12520000000", from: "+1910000000", text: "test"}, function(err, message){
      if(err){
        return console.error("Error: %s", err);
      }
      console.log(message);
    });

And

    var catapult = require("node-bandwidth");
        var client = new catapult.Client("u-xxxxx", "t-xxxxx", "xxxxx");
    catapult.Message.create(client,  {to: "+12520000000", from: "+1910000000", text: "test"}, function(err, message){
      if(err){
        return console.error("Error: %s", err);
      }
      console.log(message);
    });

Both pieces of code work fine.

node-bandwidth is 1.0.8, node is 0.12.0. Tested on Mac OS X 10.10.3 and Debian Linux 8

@wtcross
Copy link

wtcross commented May 6, 2015

Could you try it again with node 0.10.x? It isn't working for me either. I
see the Travis build uses 0.10, but there might be something odd going on.
I'll put a stack trace in the issue with my node and client versions too
within a couple of hours.
On May 6, 2015 2:30 AM, "avbel" notifications@github.com wrote:

I have tested.

var catapult = require("node-bandwidth");
catapult.Client.globalOptions.userId = "u-xxxxx";
catapult.Client.globalOptions.apiToken = "t-xxxxx";
catapult.Client.globalOptions.apiSecret = "xxxxxx";
catapult.Message.create( {to: "+12520000000", from: "+1910000000", text: "test"}, function(err, message){
if(err){
return console.error("Error: %s", err);
}
console.log(message);
});

And

var catapult = require("node-bandwidth");
var client = new catapult.Client("u-xxxxx", "t-xxxxx", "xxxxx");
catapult.Message.create(client, {to: "+12520000000", from: "+1910000000", text: "test"}, function(err, message){
if(err){
return console.error("Error: %s", err);
}
console.log(message);
});

Both pieces of code work fine.

node-bandwidth is 1.0.8, node is 0.12.0. Tested on Mac OS X 10.10.3 and
Debian Linux 8


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

@avbel
Copy link
Contributor

avbel commented May 6, 2015

Node 0.10.38. Same result

@wtcross
Copy link

wtcross commented May 6, 2015

Here is a globally configured client example. It works.

Here is a non-globally configured client example. It also works.

I'm using node v0.10.38 on Ubuntu 15.04. Thanks for the thoroughness in checking out @avbel !

@wtcross
Copy link

wtcross commented May 6, 2015

I was basing my previous comment off memory.

@nguyer
Copy link
Contributor Author

nguyer commented May 6, 2015

Okay, this actually is working for me now. I'm not sure what was different when it didn't work before. Thanks guys!

@nguyer nguyer closed this as completed May 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants