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

@@ -0,0 +1,3 @@
# API Server
This is a docker template to create your own API Server using the embedchain package. To know more about the API Server and how to use it, go [here](https://docs.embedchain.ai/examples/api_server).

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: