0

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?

Daniel Eder
  • 90
  • 1
  • 6

1 Answers1

0

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

Jimmy
  • 35,686
  • 13
  • 80
  • 98
  • This seems to be the case. For my use case I resorted to registering different rooms via a command and only send to those rooms that registered for my plugin. Still thanks for your reply! – Daniel Eder Feb 19 '16 at 15:00