# Session Timeout Callback function

**URL:** <https://forum.rasa.com/t/session-timeout-callback-function/31570>\
**Category:** Rasa Open Source\
**Created:** [July 20, 2020, 3:50pm UTC](https://forum.rasa.com/t/session-timeout-callback-function/31570 "2020-07-20T15:50:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alkak95](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@alkak95](https://forum.rasa.com/u/alkak95)\
**Post date:** [July 20, 2020, 3:50pm UTC](https://forum.rasa.com/t/session-timeout-callback-function/31570/1 "2020-07-20T15:50:02Z")

</div>

Is there any callback when session timesout . Session\_expiration\_time just tells the inactivity time but is there any way I can detect in the code through any function that session has timed out for a user, as I want to perform custom action when it expires.

---

<div class="post-metadata">

**Author:** ![b-quachtran](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@b-quachtran](https://forum.rasa.com/u/b-quachtran)\
**Post date:** [July 27, 2020, 9:45pm UTC](https://forum.rasa.com/t/session-timeout-callback-function/31570/2 "2020-07-27T21:45:13Z")

</div>

When the session expires, Rasa will call action\_session\_start so you can add the custom action code there.

---

<div class="post-metadata">

**Author:** ![rudi](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rudi/32/21369_2.png) [@rudi](https://forum.rasa.com/u/rudi)\
**Post date:** [July 28, 2020, 6:39am UTC](https://forum.rasa.com/t/session-timeout-callback-function/31570/3 "2020-07-28T06:39:24Z")

</div>

From my experience, this only happens once and if the user sends in a message.

So for example, if the session timeout is set to 5 minutes, after 5 minutes nothing will happen; if then the user accesses the bot after 10 minutes, then `action_session_start` will be called at that point.

---

<div class="post-metadata">

**Author:** ![alkak95](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@alkak95](https://forum.rasa.com/u/alkak95)\
**Post date:** [July 28, 2020, 10:15am UTC](https://forum.rasa.com/t/session-timeout-callback-function/31570/4 "2020-07-28T10:15:14Z")

</div>

Yes, That’s correct. Until you come back to bot after session expires, action\_session\_start is not called. I was looking for something which should be called automatically when session ends.

---

<div class="post-metadata">

**Author:** ![themrcesi](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/themrcesi/32/14099_2.png) [@themrcesi](https://forum.rasa.com/u/themrcesi)\
**Post date:** [April 23, 2021, 8:11am UTC](https://forum.rasa.com/t/session-timeout-callback-function/31570/5 "2021-04-23T08:11:32Z")

</div>

@rudi did you manage to solve this problem? I´m having the same problema, action\_session\_start only triggers when the user sends a message after the expiration time.

---

<div class="post-metadata">

**Author:** ![rudi](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rudi/32/21369_2.png) [@rudi](https://forum.rasa.com/u/rudi)\
**Post date:** [April 23, 2021, 10:16am UTC](https://forum.rasa.com/t/session-timeout-callback-function/31570/6 "2021-04-23T10:16:32Z")

</div>

No, there’s nothing in Rasa to have actions performed outside of a user’s request, besides the following two features:

[Reaching Out to the User](https://rasa.com/docs/rasa/reaching-out-to-user#reminders) - but reminders are stored in memory, so you can’t have a lot of them, and you lose them if the server crashes or restarts, so I wouldn’t rely on them

[Reaching Out to the User](https://rasa.com/docs/rasa/reaching-out-to-user#external-events) - External events, but this requires you to build something that stores and performs the triggers.

---

<div class="post-metadata">

**Author:** ![themrcesi](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/themrcesi/32/14099_2.png) [@themrcesi](https://forum.rasa.com/u/themrcesi)\
**Post date:** [April 23, 2021, 12:57pm UTC](https://forum.rasa.com/t/session-timeout-callback-function/31570/7 "2021-04-23T12:57:30Z")

</div>

Okay, I´ll check them out.

Thanks! 🙂
