Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

problem with external api integration #902

Closed
changux opened this issue Jun 25, 2017 · 4 comments
Closed

problem with external api integration #902

changux opened this issue Jun 25, 2017 · 4 comments

Comments

@changux
Copy link

changux commented Jun 25, 2017

Hi all,

I am trying to reproduce the code example from this repo:

After:

$ SLACK_TOKEN="xxxxxxx-xxxxxxxxxxxxxxxxx" nodemon index.js

and send a private message to bot in slack, the console message is:

Connected to FOO as mcbot
/Users/user/src/simple/index.js:16
  channel.send(`Hello to you too, ${user.name}!`)
          ^

TypeError: channel.send is not a function
    at bot.respondTo (/Users/user/src/simple/index.js:16:11)
    at RTMClient.Bot.slack.on (/Users/user/src/simple/Bot.js:47:11)
    at RTMClient.emit (/Users/user/src/simple/node_modules/eventemitter3/index.js:116:35)
    at RTMClient.emit (/Users/user/src/simple/node_modules/@slack/client/lib/clients/client.js:86:39)
    at RTMClient._handleWsMessageViaEventHandler (/Users/user/src/simple/node_modules/@slack/client/lib/clients/rtm/client.js:447:10)
    at RTMClient.handleWsMessage (/Users/user/src/simple/node_modules/@slack/client/lib/clients/rtm/client.js:401:10)
    at WebSocket.wrapper (/Users/user/src/simple/node_modules/lodash/index.js:3095:19)
    at emitTwo (events.js:106:13)
    at WebSocket.emit (events.js:194:7)
    at Receiver.ontext (/Users/user/src/simple/node_modules/ws/lib/WebSocket.js:841:10)
    at /Users/user/src/simple/node_modules/ws/lib/Receiver.js:536:18
    at Receiver.applyExtensions (/Users/user/src/simple/node_modules/ws/lib/Receiver.js:371:5)
    at /Users/user/src/simple/node_modules/ws/lib/Receiver.js:508:14
    at Receiver.flush (/Users/user/src/simple/node_modules/ws/lib/Receiver.js:347:3)
    at Receiver.finish (/Users/user/src/simple/node_modules/ws/lib/Receiver.js:541:12)
    at Receiver.expectHandler (/Users/user/src/simple/node_modules/ws/lib/Receiver.js:499:31)

Product's versions...

node --version
v7.10.0

Any idea?

Thanks!

@Naktibalda
Copy link
Contributor

@changux it looks like a simple programming mistake to me.
Please provide more code (the first 20 lines of index.js should be enough).

@changux
Copy link
Author

changux commented Jun 29, 2017

@Naktibalda
Copy link
Contributor

Your bot is not using botkit.
https://github.com/PacktPublishing/Building-Slack-Bots/blob/master/Chapter%203/package.json

@changux
Copy link
Author

changux commented Jun 29, 2017

Sorry, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants