r7kamura / ruboty-slack

Slack adapter for Ruboty.
MIT License
27 stars 9 forks source link

Cannot connect to slack server #3

Open daisy1754 opened 10 years ago

daisy1754 commented 10 years ago

I'm trying to set ruboty up for our server, but without success.

Here is what I did:

  1. Followed README
  2. I'm not an admin, so I asked the admin to get gateway access https://my.slack.com/account/gateways
  3. Deployed on heroku, but nothing happens
  4. Run locally (bundle exec ruboty ), program seems stopping, C-c, stacktrace seems program stopped at slack#connect method call

You can find related files here https://gist.github.com/daisy1754/17d0989d4d3556875ab4 (There are error log related to redis, since I initially included ruboty-redis in Gemfile. Now I remove that from gem, still cannot get ruboty to run)

Thanks,

r7kamura commented 10 years ago

Thank you for your issuing, I looked into the log file.

It seems that your program was searching for the XMPP host server but failed. ruboty-slack resolves the host from "#{ENV['SLACK_TEAM']}.xmpp.slack.com". Are you using correct SLACK_TEAM env variable? For instance we are using SLACK_TEAM=tqhouse for our https://tqhouse.slack.com organization.

daisy1754 commented 10 years ago

I'm afraid I suspect something wrong with Xrc library (which seems made by you). From irb, I try following code (changed password and roomname), with no luck

require "xrc"

client = Xrc::Client.new(
  jid: "kazuki@ourteam.xmpp.slack.com",
  password: "My password",
  nickname: "kazuki",
  room_jid: "general@conference.ourteam.xmpp.slack.com"
)
client.connect

I also try xmpp4r library, and with following code, I could post message

require 'xmpp4r'
require 'xmpp4r/client'
require 'xmpp4r/muc'
include Jabber

jid = JID.new("kazuki@ourteam.xmpp.slack.com")
client.connect
client.auth "My password"
client.send(Presence.new.set_type(:available))

muc = Jabber::MUC::MUCClient.new(client)
muc.join(Jabber::JID::new("general@conference.ourteam.xmpp.slack.com/" + client.jid.node))

message = Message.new(muc.jid, "Test")
muc.send(message)

By the way, I tried to use my own account (with which I already logged in from bunch of browsers) as bot account. This may be cause a problem? I'll try creating new account when I have time.

r7kamura commented 10 years ago

By the way, I tried to use my own account (with which I already logged in from bunch of browsers) as bot account. This may be cause a problem? I'll try creating new account when I have time.

No, there is no problem to share your account with both normal use and BOT use. I often do that too for debugging :mag_right: :bug: