Node-slack-sdk: web.chat.postMessage returns invalid_array_arg when following the examples

Created on 3 Apr 2018  路  4Comments  路  Source: slackapi/node-slack-sdk

https://github.com/slackapi/node-slack-sdk#posting-a-message-with-web-api

When following the example provided at the above URL the api responds with the below error. I did a straight copy and paste from the example into a temp file and ran it (after putting my token and a proper channel ID in). This is the error I got

Error: invalid_array_arg
at handleHttpResponse (/home/twiclo/Projects/hostbot/node_modules/@slack/client/lib/clients/transports/call-transport.js:103:17)
at handleTransportResponse (/home/twiclo/Projects/hostbot/node_modules/@slack/client/lib/clients/transports/call-transport.js:153:19)
at apply (/home/twiclo/Projects/hostbot/node_modules/lodash/lodash.js:470:17)
at wrapper (/home/twiclo/Projects/hostbot/node_modules/lodash/lodash.js:5329:16)
at Request.handleRequestTranportRes (/home/twiclo/Projects/hostbot/node_modules/@slack/client/lib/clients/transports/request.js:21:5)
at apply (/home/twiclo/Projects/hostbot/node_modules/lodash/lodash.js:470:17)
at Request.wrapper [as _callback] (/home/twiclo/Projects/hostbot/node_modules/lodash/lodash.js:5329:16)
at Request.self.callback (/home/twiclo/Projects/hostbot/node_modules/request/request.js:186:22)
at Request.emit (events.js:180:13)
at Request. (/home/twiclo/Projects/hostbot/node_modules/request/request.js:1060:10)
at Request.emit (events.js:180:13)
at IncomingMessage. (/home/twiclo/Projects/hostbot/node_modules/request/request.js:980:12)
at Object.onceWrapper (events.js:272:13)
at IncomingMessage.emit (events.js:185:15)
at endReadableNT (_stream_readable.js:1106:12)
at process._tickCallback (internal/process/next_tick.js:114:19)

There's definitely a chance I'm providing the wrong chatID. I'm passing in "D8JQ7Q6V9" which is the DM ID with me and the bot user

question

All 4 comments

@twiclo from the stack trace, it looks like your using v3 of this package, and the docs have been updated to v4 - see the migration guide for differences.

Unfortunately, we don鈥檛 have the older v3 docs hosted anywhere, but we have an issue open to track this. #486

$ npm @slack/client --version
5.6.0

Is that version different than what I should be running? How do I check the real version to make sure I'm good?

Oh sorry for the confusion. That鈥檚 your version of NPM. I meant the version of the @slack/client package, which is usually specified in your package.json file under the key dependencies.

If you want to upgrade to the latest you could just run npm install @slack/client@4. It should handle updating your package.json as well.

Okay thanks for the help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhang699 picture zhang699  路  32Comments

bobrik picture bobrik  路  25Comments

hckhanh picture hckhanh  路  21Comments

danielravina picture danielravina  路  16Comments

kurisubrooks picture kurisubrooks  路  36Comments