Rasa 1.2.9 Rest API delivering responses

Hi RASA expert,

I need to use Flask rest service with rasa 1.2.9

class WebBotService(): “”“A WebBotService that listens on a url and responds.”“”

def blueprint(self, on_new_message):
    api = Blueprint('custom_webhook', __name__)

    @api.route("/status", methods=['GET'])
    def health():
        return jsonify({"status": "ok"})

    @api.route("/", methods=['POST'])
    def receive():
        payload = request.json
        sender_id = payload.get("sender", None)
        text = payload.get("message", None)
        out = CollectingOutputChannel()
        on_new_message(UserMessage(text, out, sender_id))
        responses = [m for _, m in out.messages]
        return jsonify(responses)

    return api
   input_channel = WebBotService()
   if serve_forever:
        agent.handle_channel(RestInput(5004, "/chat", input_channel))

But Above source is not working with rasa 1.2.9

Give proper solution

Hi @janaka1984 Please specify what part of your code is not working.

hi @dakshvar22

Please give more details of what’s the error that you are getting or any unexpected behaviour. Please include a traceback if possible.