t Flask, request, jsonify
app = Flask(__name__)

@app.route("/chat", methods=["POST"])
def chat():
    user_message = request.json.get("message")
    bot_response = chatbot.get_response(user_message)
    return jsonify({"response": str(bot_response)})

if __name__ == "__main__":
    app.run()
        </code></pre>

        <h2>Step 8: Adding Escalation Features</h2>
        <pre><code>
def escalate_to_agent(user_input):
    if "speak to a representative" in user_input.lower():
        return "Sure, I'll con