class_docstr: RocketChat input channel implementation.
class_docstr_tok: ["RocketChat","input","channel","implementation","."]
code: def blueprint(
      self, on_new_message: Callable[[UserMessage], Awaitable[Any]]
  ) -> Blueprint:
      rocketchat_webhook = Blueprint("rocketchat_webhook", __name__)
  
      @rocketchat_webhook.route("/", methods=["GET"])
      async def health(_: Request) -> HTTPResponse:
          return response.json({"status": "ok"})
  
      @rocketchat_webhook.route("/webhook", methods=["GET", "POST"])
      async def webhook(request: Request) -> HTTPResponse:
          output = request.json
          metadata = self.get_metadata(request)
          if output:
              if "visitor" not in output:
                  sender_name = output.get("user_name", None)
                  text = output.get("text", None)
                  recipient_id = output.get("channel_id", None)
              else:
                  messages_list = output.get("messages", None)
                  text = messages_list[0].get("msg", None)
                  sender_name = messages_list[0].get("username", None)
                  recipient_id = output.get("_id")
  
              await self.send_message(
                  text,
                  sender_name,
                  recipient_id,
                  on_new_message,
                  metadata,
              )
  
          return response.text("")
  
      return rocketchat_webhook
  
file_path: rasa/rasa/core/channels/rocketchat.py
imports: import logging
  from sanic import Blueprint, response
  from sanic.request import Request
  from typing import Text, Dict, Any, List, Iterable, Optional, Callable, Awaitable
  from rasa.core.channels.channel import UserMessage, OutputChannel, InputChannel
  from sanic.response import HTTPResponse
label_desc: Use image node_id 4 for calling the RocketChatInput obj's underlying member method code with example usage: obj.blueprint(on_new_message) and returns: rocketchat_webhook, response, response