mardi 22 septembre 2020

How do I make Python Flask Chatbot chat with several users and store their chats

I have a flask chatbot backend and have no problem connecting it to facebook messenger. the messenger API provides user_ids so that I can match different chats to different users and save their chat logs.

Now I want to use a separate website for my chatbot. There is enough sample code out there on how to do that (see below), however, I cannot find how to get user data, so I can identify different users and keep track of their messages and save their chat logs.

from flask import Flask, render_template, request

app = Flask(__name__)
app.static_folder = 'static'

@app.route("/")
def home():
    return render_template("index.html")

@app.route("/get")
def get_bot_response():
    userText = request.args.get('msg')
    return "test response"


if __name__ == "__main__":
    app.run()

What do I need to do to keep track of all individual chats and save them separately? thanks!




Aucun commentaire:

Enregistrer un commentaire