meteor-slack-api icon indicating copy to clipboard operation
meteor-slack-api copied to clipboard

how to use the rtm start?

Open dcsan opened this issue 9 years ago • 3 comments

for the official API you can use

slack = new Slack(token, autoReconnect, autoMark)

I'm wondering if you've gone through the steps to get a websocket going after the API

SlackAPI.rtm.start(token, callback)

The url property contains a WebSocket Message Server URL. Connecting to this URL will initiate a Real Time Messaging session. These URLs are only valid for 30 seconds, so connect quickly!

about to start looking into that but asking here first!

Meteor.startup ->
  if Meteor.isServer
    slack = SlackAPI.rtm.start(token, startCb)

startCb = (err, res) ->
  console.log("slack.start", err, res)
  if err
    console.error("cant start slack.rtm")
  else
    slack = res

   # do something with it

dcsan avatar Jul 19 '15 09:07 dcsan

I got as far as using joncursi:socket-io-client and

slack = new io(res.url)

but can't seem to get any events to trigger on the connection...

dcsan avatar Jul 19 '15 09:07 dcsan

This api will not automatically connect you to the real time messaging. It will only return the url. I can look into making this automatic.

krishamoud avatar Jul 20 '15 20:07 krishamoud

Do you have a code sample of how you're using that URL?

AFAI understand opening the connection requires a Websocket which requires importing other node packages, unless i'm missing something.

dcsan avatar Jul 21 '15 17:07 dcsan