Rasa deployment to Google chat

Hi, members of Rasa! I developed a Rasa chatbot for my project and deployed it to Google Chat. I want to store and see the conversations between the bot and user (I say “see” because even though InMemoryTrackerStore is the default one, I don’t understand where it stores the data). I am trying to use the tracker stores Tracker Stores for Google chat but I fail. If you can provide any solution or help it would be greatly appreciated! Thank you for your help in advance!

You may store the data in tracker store to a DB, so that you can see anytime later

Hello,

What did you try?

This is a sample configuration for an SQL Tracker Store:

tracker_store:
    type: SQL
    dialect: "mysql"
    url: "localhost"
    db: "rasa_tracker_store"
    username:  "rasa"
    password:  "rasa"

Hi @ChrisRahme. Thanks for your answer. This is what I used:

tracker_store: type: SQL dialect: “sqlite” url: “sqlite:///./Chat.db” db: “Chat.db” username: # username used for authentication password: # password used for authentication query: # optional driver: my-driver

After this, there is a db file created. But it seems a mess and it is impossible to see the conversation as it included everything. Here is how it looks.

?a'ÇwSeyma N. Yildirim ErbasliactionAÿHπB”é;action_listen{"event": "action", "timestamp": 1629676811.305556, "name": "action_listen", "policy": "policy_0_MemoizationPolicy", "confidence": 1.0, "action_text": null, "hide_rule_turn": false}Ç		?aÉqSeyma N. Yildirim ErbaslibotAÿHπB”{"event": "bot", "timestamp": 1629676811.2985191, "metadata": {"utter_action": "utter_greet"}, "text": "Hey! How are you?", "data": {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}}Ån	?a#ÇsSeyma N. Yildirim ErbasliactionAÿHπB”7utter_greet{"event": "action", "timestamp": 1629676811.298475, "name": "utter_greet", "policy": "policy_0_MemoizationPolicy", "confidence": 1.0, "action_text": null, "hide_rule_turn": false}Å a	?1aÅUSeyma N. Yildirim Erbasliuser_featurizationAÿHπB”“{"event": "user_featurization", "timestamp": 1629676811.298451, "use_text_for_featurization": false}ä(	?aìwSeyma N. Yildirim ErbasliuserAÿHπB≤ˇ±greet{"event": "user", "timestamp": 1629676810.7968562, "metadata": {"room": null}, "text": "hi", "parse_data": {"intent": {"id": 1865928600676492346, "name": "greet", "confidence": 0.999992847442627}, "entities": [], "text": "hi", "message_id": "00a8b5d2d8234a9ba4b787a0944b4996", "metadata": {"room": null}, "intent_ranking": [{"id": 1865928600676492346, "name": "greet", "confidence": 0.999992847442627}, {"id": 8589213380093636930, "name": "bot_challenge", "confidence": 3.928860223822994e-06}, {"id": -8115760450847392978, "name": "deny", "confidence": 1.334612875325547e-06}, {"id": -4569718716967379854, "name": "affirm", "confidence": 9.102215585699014e-07}, {"id": -8744173899695903939, "name": "goodbye", "confidence": 8.074327979556983e-07}, {"id": 6186387067587524339, "name": "mood_unhappy", "confidence": 1.2777123004070745e-07}, {"id": 1966283807190876054, "name": "mood_great", "confidence": 7.397377288498319e-08}], "response_selector": {"all_retrieval_intents": [], "default": {"response": {"id": null, "responses": null, "response_templates": null, "confidence": 0.0, "intent_response_key": null, "utter_action": "utter_None", "template_name": "utter_None"}, "ranking": []}}}, "input_channel": "hangouts", "message_id": "00a8b5d2d8234a9ba4b787a0944b4996"}Å[	?a'ÇISeyma N. Yildirim ErbasliactionAÿHπBèF™action_listen{"event": "action", "timestamp": 1629676810.238688, "name": "action_listen", "policy": null, "confidence": null, "action_text": null, "hide_rule_turn": false}Å4	?a=ÅiSeyma N. Yildirim ErbaslislotAÿHπBèFosession_started_metadata{"event": "slot", "timestamp": 1629676810.238674, "name": "session_started_metadata", "value": {"room": null}}Å	?+aÅ?Seyma N. Yildirim Erbaslisession_startedAÿHπBèDÆ{"event": "session_started", "timestamp": 1629676810.2385669, "metadata": {"room": null}}Åh	?a5ÇUSeyma N. Yildirim ErbasliactionAÿHπBèAˇaction_session_start{"event": "action", "timestamp": 1629676810.238403, "name": "action_session_start", "policy": null, "confidence": 1.0, "action_text": null, "hide_rule_turn": false}Å4	?a=ÅiSeyma N. Yildirim ErbaslislotAÿHπBè/session_started_metadata{"event": "slot", "timestamp": 1629676810.237251, "name": "session_started_metadata", "value": {"room": null}}

and so on.

But I only want to see the conversation. Hope you can help.

Hi @sreewarrier. Thanks for your answer. I am already trying the tracker store. But the stored conversation is a mess. It includes everything (probabilities, names, etc). But I only want to see the conversation. Here is how it looks:

?a'ÇwSeyma N. Yildirim ErbasliactionAÿHπB”é;action_listen{"event": "action", "timestamp": 1629676811.305556, "name": "action_listen", "policy": "policy_0_MemoizationPolicy", "confidence": 1.0, "action_text": null, "hide_rule_turn": false}Ç		?aÉqSeyma N. Yildirim ErbaslibotAÿHπB”{"event": "bot", "timestamp": 1629676811.2985191, "metadata": {"utter_action": "utter_greet"}, "text": "Hey! How are you?", "data": {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}}Ån	?a#ÇsSeyma N. Yildirim ErbasliactionAÿHπB”7utter_greet{"event": "action", "timestamp": 1629676811.298475, "name": "utter_greet", "policy": "policy_0_MemoizationPolicy", "confidence": 1.0, "action_text": null, "hide_rule_turn": false}Å a	?1aÅUSeyma N. Yildirim Erbasliuser_featurizationAÿHπB”“{"event": "user_featurization", "timestamp": 1629676811.298451, "use_text_for_featurization": false}ä(	?aìwSeyma N. Yildirim ErbasliuserAÿHπB≤ˇ±greet{"event": "user", "timestamp": 1629676810.7968562, "metadata": {"room": null}, "text": "hi", "parse_data": {"intent": {"id": 1865928600676492346, "name": "greet", "confidence": 0.999992847442627}, "entities": [], "text": "hi", "message_id": "00a8b5d2d8234a9ba4b787a0944b4996", "metadata": {"room": null}, "intent_ranking": [{"id": 1865928600676492346, "name": "greet", "confidence": 0.999992847442627}, {"id": 8589213380093636930, "name": "bot_challenge", "confidence": 3.928860223822994e-06}, {"id": -8115760450847392978, "name": "deny", "confidence": 1.334612875325547e-06}, {"id": -4569718716967379854, "name": "affirm", "confidence": 9.102215585699014e-07}, {"id": -8744173899695903939, "name": "goodbye", "confidence": 8.074327979556983e-07}, {"id": 6186387067587524339, "name": "mood_unhappy", "confidence": 1.2777123004070745e-07}, {"id": 1966283807190876054, "name": "mood_great", "confidence": 7.397377288498319e-08}], "response_selector": {"all_retrieval_intents": [], "default": {"response": {"id": null,

… and so on

@seymanur Hey! What is your rasa version and you planning to use which database is it MySQL or Postgres etc

Can you try to set url as the full path instead of sqlite:///./Chat.db?

This is how the database looks by the way:

Thanks @ChrisRahme. It did not make a difference. Thank you for sharing how it looks. Actually for me, this is not how I see it. I am a Mac user and work on terminal. Here are the screenshots of the folder I create including the Chat.db. I can open the Chat.db file using TextEdit only.

Yes sorry, the picture I shared is how the database will appear in MySQL, not in the .db file.

As for why it doesn’t work… I don’t know to be honest. Try writing a small Python script to test the connection with this URL and see if it works.

Thank you! Can I also register and see db in MySQL? At least, it seems more organized. Can I ask whether under data column, you see the entire conversation for each user or a new row created for each entry?

Best!

Yes, this is the configuration for MySQL, simpler than SQLite :slight_smile:

In the data column you can just see info about 1 message.

Thanks a lot for all your help and time! I will try it right away, finger crossed :slight_smile:

1 Like

@seymanur you just want to store the the bot/user conversation in any database ?

For storing the bot/user conversation you can use tracker store:

Update this code in endpoints.yml

For Postgres:

tracker_store:
   type: SQL
   dialect: "postgresql"  # the dialect used to interact with the db
   url: "localhost"  # (optional) host of the sql db, e.g. "localhost"
   db: "chatbot"  # path to your db
   username: "postgres"  # username used for authentication
   password: "123"  # password used for authentication
   # query: # optional dictionary to be added as a query string to the connection URL
   #   driver: my-driver

For MySQL:

tracker_store:
   type: SQL
   dialect: "mysql+pymysql"  # the dialect used to interact with the db
   url: "localhost"  # (optional) host of the sql db, e.g. "localhost"
   db: "rasa"  # path to your db
   username: "root"  # username used for authentication
   password: "root"  # password used for authentication

Note: You also can need to install psycopg2-binary and pymysql. You will see when it will thrown error.

@seymanur You need to create a database schema i.e rasa (or whatever you feel like) and update same in db: rasa, train the bot and run rasa and rasa actions in separate terminals; whilst running you will get above mention errors or some other please install in your conda environment and again train and follow the process.

Good Luck!

Hi! Thank you for the detailed instructions! Now, I am able to store the conversations and see them properly. Many thanks again!

Best!

@seymanur Great! please close this thread with the solution for others and good luck with your project!

Here are the steps I followed:

In the credentials.yml

1- hangouts: no credentials required here 2- Create project in google cloud 3- Select Go to APIs overview. 4- On the grid click Hangouts Chat API 5- Click Configuration 6- Bot url should be: https://.ngrok.io/webhooks/hangouts/webhook

In the endpoints.yml tracker_store:

 type: SQL
 dialect: "sqlite"  # the dialect used to interact with the db
 url: "sqlite:///./Chat.db"
 db: "Chat.db"  # path to your db
 username:  # username used for authentication
 password:  # password used for authentication
 query: # optional dictionary to be added as a query string to the connection URL
 driver: my-driver

2- Open a new terminal (if you are a Mac user) and run sqlite3 3- run sqlite Chat.db

Have you used any python code for this to configure databases?