• Resolved Abishek Newar

    (@abishekcoolplugins)


    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

    (@valwa)

    Hey @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. Hope this helps!

    Thread Starter Abishek Newar

    (@abishekcoolplugins)

    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

    (@tigroumeow)

    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:

    https://docs.meowapps.com/features–tutorials/qxAxYBjw7r1TyR9xEeNgEg/actions-shortcuts–blocks/q7S96T78QDjWJSyYEmnWn4

    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

    (@abishekcoolplugins)

    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

    Plugin Support Val Meow

    (@valwa)

    Hey @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.