API requests returning large JSON strings return undefined.
Closed this issue · 4 comments
pixelrebel commented
In hubot, getting a lot of undefined errors for list calls:
This works!
slack.api.channels.list({}, function (err, res) {
if (err) { throw err; }
console.log(res);
});
This returns "TypeError: object is not a function"
slack.api.users.list({}, function (err, res) {
if (err) { throw err; }
console.log(res);
});
This returns "TypeError: object is not a function"
slack.api.im.list({}, function (err, res) {
if (err) { throw err; }
console.log(res);
});
This returns "TypeError: Cannot read property 'list' of undefined"
slack.api.files.list({}, function (err, res) {
if (err) { throw err; }
console.log(res);
});
germanrcuriel commented
Hi @pixelrebel! Thanks for creating an issue. I will try to explain each case:
slack.api.users.list
only accepts one argument, it should be the callback function.
slack.api.users.list(function (err, res) {
if (err) { throw err; }
console.log(res);
});
- The same applies to
slack api.im.list
.
slack.api.im.list(function (err, res) {
if (err) { throw err; }
console.log(res);
});
- And for the
slack.api.files.list
I'm afraid that thefiles
resource it's not implemented yet.
Hope it helps! 😉
pixelrebel commented
Got it working now. Thanks! BTW, are you working on a files.upload multipart/form-data method? I can only get this to work via curl. Haven't figured out how to implement using scoped-http-client.
germanrcuriel commented
Yes, I'm working on it but I don't know when I will do the release.
pixelrebel commented
Awesome, great work!