Lita.io Handler Plugin - How to get a list of all joined rooms

152 Views Asked by At

I am in the process of writing a Handler Plugin for lita.io. What I want to do is provide a HTTP POST endpoint and when it is called I want to publish some chat message to all rooms that Lita has joined.

I already succeeded with posting to a specific room that is identified as parameter in the HTTP call doing it like this:

def receive(request, response)
room = request.params['room']
    Lita.logger.debug("stash-post-receive: room = #{room}")
    target = Source.new(room: room)
    json_data = parse_json(request.body.read) or return
    message = format_message(json_data)
    robot.send_message(target, message)
end

But this requires the caller to already supply which room to post to. Is there a way to retrieve a list of all rooms that Lita has joined so I can post there?

1

There are 1 best solutions below

1
On BEST ANSWER

Currently there is not a generic way to do this. The adapter would have to expose an adapter-specific API for it.