You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
I try to have Lita BOT to send_messages to a hipchat room, but never succeeded.
Here are my code:
defget_target_by_user(owner)user=Lita::User.find_by_name(owner)# Need to prevent the user does not exist in hipchat.returnnilifuser.nil?returnLita::Source.new(user: user)enddefget_target_by_room(room)room=Lita::Room.find_by_name(room)# Need to prevent the user does not exist in hipchat.returnnilifroom.nil?robot.join(room)returnLita::Source.new(room: room)enddefsend_message_to_target(target,header,msg)log.info("sending message to #{target.inspect}")robot.send_messages(target,header)robot.send_messages(target,msg)enddefsend_message(owner,cc,header,msg)receivers=[owner]receivers += ccif not cc.nil?receivers.eachdo |owner|
begintarget=get_target_by_user(owner)iftarget.nil?target=get_target_by_room(owner)endnextiftarget.nil?# skip if user does not exist in hipchat.send_message_to_target(target,header,msg)rescueStandardError=>elog.error("Error when sending message to #{target}: #{e}")endendendheader="(failed) Test"msg="Test message\n"config.notify_to.eachdo |owner|
send_message(owner,nil,header,msg)end
And the log likes the following: We can see it sent to the user successfully, but did not send message to the room. So what could be the problem?
[] [DEBUG] Already in room with JID [email protected]
[] [INFO] sending message to #<Lita::Source:0x007fe42d4648f8 @user=nil, @room="599001_devtestroom", @room_object=#<Lita::Room:0x007fe42d466018 @id="599001_devtestroom", @metadata={"name"=>"599001_devtestroom"}, @name="599001_devtestroom">, @private_message=false>
[] [INFO] sending message to #<Lita::Source:0x007fe42d45dbe8 @user=#<Lita::User:0x007fe42d45dcd8 @id="[email protected]", @metadata={"mention_name"=>"AutumnWang", "email"=>"[email protected]", "name"=>"Autumn Wang"}, @name="Autumn Wang">, @private_message=true>
[] [DEBUG] Sending message to JID [email protected]: (failed) Test
[] [DEBUG] Sending message to JID [email protected]: Test message
The text was updated successfully, but these errors were encountered:
I found the problem lies in room ID: In redis, the room ID missed the domain name "@chat.hipchat.com", while user ID is correct. That is why user works, but Room does not work.
In hipchat, the Room ID does include the domain name "XMPP JID [email protected]".
Hi,
I try to have Lita BOT to send_messages to a hipchat room, but never succeeded.
Here are my code:
And the log likes the following: We can see it sent to the user successfully, but did not send message to the room. So what could be the problem?
The text was updated successfully, but these errors were encountered: