class_docstr: Mattermost input channel implemenation.
class_docstr_tok: ["Mattermost","input","channel","implemenation","."]
code: def blueprint(
      self, on_new_message: Callable[[UserMessage], Awaitable[None]]
  ) -> Blueprint:
      mattermost_webhook = Blueprint("mattermost_webhook", __name__)
  
      @mattermost_webhook.route("/", methods=["GET"])
      async def health(_: Request) -> HTTPResponse:
          return response.json({"status": "ok"})
  
      @mattermost_webhook.route("/webhook", methods=["POST"])
      async def webhook(request: Request) -> HTTPResponse:
          output = request.json
  
          if not output:
              return response.text("")
  
          metadata = self.get_metadata(request)
          # handle normal message with trigger_word
          if "trigger_word" in output:
              await self.message_with_trigger_word(
                  on_new_message, output, metadata
              )
  
          # handle context actions from buttons
          elif "context" in output:
              await self.action_from_button(
                  on_new_message, output, metadata
              )
  
          return response.text("success")
  
      return mattermost_webhook
  
imports: import json
  import logging
  import requests
  from requests import Response
  from sanic import Blueprint, response
  from sanic.request import Request
  from typing import Text, Dict, Any, List, Callable, Awaitable, Optional
  from rasa.core.channels.channel import UserMessage, OutputChannel, InputChannel
  from sanic.response import HTTPResponse
label_desc: Use image node_id 4 for calling the MattermostInput obj's underlying member method code with example usage: obj.blueprint(on_new_message) and returns: mattermost_webhook, response, response, response