# How to force all messages to trigger python class?

**URL:** <https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871>\
**Category:** Rasa Open Source\
**Created:** [April 25, 2021, 1:51pm UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871 "2021-04-25T13:51:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![joggerjoel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/joggerjoel/32/14583_2.png) [@joggerjoel](https://forum.rasa.com/u/joggerjoel)\
**Post date:** [April 25, 2021, 1:51pm UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/1 "2021-04-25T13:51:29Z")

</div>

Hello, I’m interested to capture every message being processed in Rasa by creating a python class which will store to database. I’m not exactly sure how to do this by default. I can trigger the class based on stories that match, but I can’t seem to figure out as a default.

Any guidance would be appreciated Thanks.

---

<div class="post-metadata">

**Author:** ![siriusraja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/siriusraja/32/22306_2.png) [@siriusraja](https://forum.rasa.com/u/siriusraja)\
**Post date:** [April 25, 2021, 4:40pm UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/2 "2021-04-25T16:40:03Z")

</div>

Hi @joggerjoel

May I know which message you are referring to and what are you planning to do by storing in database?

---

<div class="post-metadata">

**Author:** ![joggerjoel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/joggerjoel/32/14583_2.png) [@joggerjoel](https://forum.rasa.com/u/joggerjoel)\
**Post date:** [April 25, 2021, 10:38pm UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/3 "2021-04-25T22:38:31Z")

</div>

all messages

I’m interested in storing the timestamp/confidence make decisions future messages in realtime.

---

<div class="post-metadata">

**Author:** ![siriusraja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/siriusraja/32/22306_2.png) [@siriusraja](https://forum.rasa.com/u/siriusraja)\
**Post date:** [April 26, 2021, 7:17am UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/4 "2021-04-26T07:17:49Z")

</div>

Hi @joggerjoel

These information’s are already saved to trackerstore database, if you want read from a DB. Else, they are readily available in the tracker object which you can access them via your custom actions.

Can you share me a specific example to see if I can help you out ?

---

<div class="post-metadata">

**Author:** ![KheireddineAzzez](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/kheireddineazzez/32/17869_2.png) [@KheireddineAzzez](https://forum.rasa.com/u/KheireddineAzzez)\
**Post date:** [April 26, 2021, 8:07am UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/5 "2021-04-26T08:07:35Z")

</div>

Like interceptor …?

---

<div class="post-metadata">

**Author:** ![joggerjoel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/joggerjoel/32/14583_2.png) [@joggerjoel](https://forum.rasa.com/u/joggerjoel)\
**Post date:** [April 26, 2021, 11:05am UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/6 "2021-04-26T11:05:51Z")

</div>

I added this to my endpoints.yml:

```auto
 tracker_store:
    type: SQL
    dialect: "mysql"
    url: "localhost:3306"
    db: "rasa" # path to your db
    username: root # username used for authentication
    password: password # password used for authentication

```

> rasa run --endpoints endpoints.yml created rasa database in mysql. But nothing is being updated and I don’t see anything on the startup console log.

Thoughts? Thanks.

---

<div class="post-metadata">

**Author:** ![siriusraja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/siriusraja/32/22306_2.png) [@siriusraja](https://forum.rasa.com/u/siriusraja)\
**Post date:** [April 26, 2021, 11:14am UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/7 "2021-04-26T11:14:22Z")

</div>

Hi @joggerjoel

Please enable `debug` while starting up the rasa server and share the logs.

---

<div class="post-metadata">

**Author:** ![joggerjoel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/joggerjoel/32/14583_2.png) [@joggerjoel](https://forum.rasa.com/u/joggerjoel)\
**Post date:** [April 27, 2021, 9:57am UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/8 "2021-04-27T09:57:03Z")

</div>

[debug.txt](https://forum.rasa.com/uploads/short-url/3nXXfpA0GkX2zTRIStzPoC4haKB.txt) (3.6 KB)

---

<div class="post-metadata">

**Author:** ![siriusraja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/siriusraja/32/22306_2.png) [@siriusraja](https://forum.rasa.com/u/siriusraja)\
**Post date:** [April 28, 2021, 6:10am UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/9 "2021-04-28T06:10:57Z")

</div>

Hi @joggerjoel

From your logs, I can see rasa is still using its default Trackerstore & Lockstore

```
2021-04-27 05:52:53,435 [DEBUG] Connected to InMemoryTrackerStore.
2021-04-27 05:52:53,435 [DEBUG] Connected to lock store 'InMemoryLockStore'.

```

Also I see another rasa instance running because of which your current instance didn’t start up. Try killing the existing instance and start afresh.

Also ensure you are passing your endpoints.yml while starting rasa instance

---

<div class="post-metadata">

**Author:** ![joggerjoel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/joggerjoel/32/14583_2.png) [@joggerjoel](https://forum.rasa.com/u/joggerjoel)\
**Post date:** [April 28, 2021, 2:09pm UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/10 "2021-04-28T14:09:57Z")

</div>

./endpoints.yml

```auto
tracker_store:
    type: SQL
    dialect: "mysql"
    url: "mysql://localhost:3306"
    db: "rasa" # path to your db
    username: root # username used for authentication
    password: password # password used for authentication

```

rasa run --endpoints endpoints.yml --debug --log-file log.txt apparently I had a space in front of “tracker\_store” also, I had to remove mysql::// as it was expecting username password from URL

```auto
2021-04-28 10:08:32 DEBUG rasa.core.tracker_store - Attempting to connect to database via 'mysql://root:***@localhost:3306/rasa'.
2021-04-28 10:08:32 DEBUG rasa.core.tracker_store - Connection to SQL database 'rasa' successful.
2021-04-28 10:08:32 DEBUG rasa.core.tracker_store - Connected to SQLTrackerStore.

```

Now it works.

---

<div class="post-metadata">

**Author:** ![joggerjoel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/joggerjoel/32/14583_2.png) [@joggerjoel](https://forum.rasa.com/u/joggerjoel)\
**Post date:** [April 28, 2021, 2:16pm UTC](https://forum.rasa.com/t/how-to-force-all-messages-to-trigger-python-class/42871/11 "2021-04-28T14:16:23Z")

</div>

“timestamp”: 1619618811.1111634,

How to change this to a python printable time? Is this in milliseconds? whats the .1111634
