add: WhatsApp, Slack and Telegram bots (#438)

This commit is contained in:
Sahil Kumar Yadav
2023-08-15 03:10:25 +05:30
committed by GitHub
parent 09c02954ba
commit e3ae84b80d
23 changed files with 384 additions and 4 deletions

View File

@@ -26,6 +26,19 @@ def add():
@app.route("/query", methods=["POST"])
def query():
data = request.get_json()
question = data.get("question")
if question:
try:
response = chat_bot.query(question)
return jsonify({"data": response}), 200
except Exception:
return jsonify({"error": "An error occurred. Please try again!"}), 500
return jsonify({"error": "Invalid request. Please provide 'question' in JSON format."}), 400
@app.route("/chat", methods=["POST"])
def chat():
data = request.get_json()
question = data.get("question")
if question: