Title: timer function
Last modified: April 10, 2025

---

# timer function

 *  Resolved [Abishek Newar](https://wordpress.org/support/users/abishekcoolplugins/)
 * (@abishekcoolplugins)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/timer-function/)
 * I want to add a timer function. Basically if a user is inactive or doesn’t text
   for certain time such as 5 minutes then the chat will reply a inactive message
   automatically

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [Val Meow](https://wordpress.org/support/users/valwa/)
 * (@valwa)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/timer-function/#post-18413647)
 * Hey [@abishekcoolplugins](https://wordpress.org/support/users/abishekcoolplugins/)!
   👋
 * There are multiple ways you can do that — either through JavaScript with a client-
   side timer to lock the chatbot after a certain duration, or on the server side
   using a filter like mwai_ai_allowed, which will display an error message in the
   chatbot once a message is sent after a time limit is reached.
 * You can find both the filters and JS functions in the [AI Engine API documentation](https://meowapps.com/ai-engine/api/).
   Hope this helps!
 *  Thread Starter [Abishek Newar](https://wordpress.org/support/users/abishekcoolplugins/)
 * (@abishekcoolplugins)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/timer-function/#post-18417141)
 * Thank you for your response,
 * but if the user closes the browser the injected code would disappear and then
   the chat can be continued even after the time limit of being inactive, i have
   tried to do that using blocks but it is the problem that i am facing
 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/timer-function/#post-18417186)
 * When a user closes the browser, any injected or regular code disappears – it’s
   the same in both cases. I’m not entirely sure what you’re aiming for; could you
   explain your goal a bit more clearly?
 * If you’re thinking about interacting with a chat after the user closes their 
   browser, that’s technically either impossible or very complicated. The user wouldn’t
   see this anyway, so it might not make much sense.
 * If you want to send a message through the chatbot automatically after some time,
   that’s not a built-in feature, but you could do it easily with some injected 
   code (that should not be build inside the plugin, I wouldn’t do it neither even
   if I need it). I would use `setBlocks` via the MwaiAPI in JavaScript, this is
   the way to do it! 🙂 It’s pretty straightforward. Here’s a link to help you get
   started:
 * 
 * Try exploring the plugin’s native features and API first, and take a look at 
   the documentation. It’s a powerful tool, and we designed it to be easy to customize
   using filters and actions.
 *  Thread Starter [Abishek Newar](https://wordpress.org/support/users/abishekcoolplugins/)
 * (@abishekcoolplugins)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/timer-function/#post-18418870)
 * The block would be executed after the first chat but i want the code to be executed
   on just loading the site not after the first chat, just like maybe shortcuts 
   but in shortcut we cannot inject js. i want to make a feature such that if the
   user starts a chat once and then if he doesn’t sends another chat (maybe within
   30 mins), the chat would be locked and then a block will be added that the chat
   has ended due to inactivity.
 * this feature might not be possible only with backend i think this need the frontend
   to be changes a bit
    -  This reply was modified 1 year, 1 month ago by [Abishek Newar](https://wordpress.org/support/users/abishekcoolplugins/).
 *  Plugin Support [Val Meow](https://wordpress.org/support/users/valwa/)
 * (@valwa)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/timer-function/#post-18426135)
 * Hey [@abishekcoolplugins](https://wordpress.org/support/users/abishekcoolplugins/)!
   👋
 * There’s no out-of-the-box solution for your exact use case, so you’ll need to
   use the available tools to build something custom. You’ll likely need a mix of
   front-end and back-end code to track user inactivity across your website — for
   example, by using shared metadata — and then display a block inside the chatbot
   based on that value.
 * This is just one possible approach. If needed, we recommend reaching out to an
   experienced freelancer to help you implement it.
 * Please note that this is not officially supported by AI Engine, so we’ll consider
   this topic closed for now. Thanks for your understanding — hope this helps!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘timer function’ is closed to new replies.

 * ![](https://ps.w.org/ai-engine/assets/icon-256x256.png?rev=3431928)
 * [AI Engine - The Chatbot, AI Framework & MCP for WordPress](https://wordpress.org/plugins/ai-engine/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ai-engine/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ai-engine/)
 * [Active Topics](https://wordpress.org/support/plugin/ai-engine/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ai-engine/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ai-engine/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Val Meow](https://wordpress.org/support/users/valwa/)
 * Last activity: [1 year, 1 month ago](https://wordpress.org/support/topic/timer-function/#post-18426135)
 * Status: resolved