tonybaloney / hubot-spark

A hubot integration for Cisco Spark
Apache License 2.0
14 stars 6 forks source link

hubot-spark not receiving messages? #8

Closed jcapayne closed 6 years ago

jcapayne commented 7 years ago

I can't get my hubot to receive any messages from spark. Debug logging provides:

Unhandled rejection {"message":"Failed to get activity.","errors":[{"description":"Failed to get activity."}],"trackingId":""}

tonybaloney commented 7 years ago

sounds like a connectivity or authentication issue. Are you able to run a http logging proxy locally like fiddler and see the API responses?

namachieli commented 7 years ago

So looking into this as i have the same problem.

It looks like the parameter 'mentionedPeople=me' is not being passed.

The exact error @jcapayne mentioned is returned from spark API when you try to list messages from a room with with "type": "room", without 'mentionedPeople=me' being passed. When you do pass it, it works.

Unfortunately we can't just always send it, because if you pass that parameter for rooms with "type": "direct", it returns 0 messages because @mentions don't work in direct rooms.

It looks to me like in /src/spark-api.coffee it's got the logic to check if you are a bot, and pass the option, but it doesn't appear to be working (or being called?). According to the error on line 23, if the check was ran against a non-bot auth token, it should fail and error out. I tried configuring hubot with my personal access token, and it happily worked not caring that i was not a bot and I was able to send messages to the bot in the group room.

We need to update this so not only is the parameter passed for the correct room type, but also be able to tell the difference in the room type, which it doesn't look like this module does.

I'm barely able to read JS/Coffee so I can't attempt to fix it without spending some time learning this language. Hopefully @tonybaloney or @selesse can help out :)

namachieli commented 7 years ago

So after updating the local version of spark to 2.0 and the local version of NPM to the latest, This is working for me.

tonybaloney commented 6 years ago

thanks @namachieli closing issue.