how can I create an application that runs periodicall

5 Comments

  • Zach Anthony
    Comment actions Permalink

    Hi David,

    Depending on your use case you may be able to achieve what you're intending to do by using the Background location in Support. We don't have any specific tutorials on this but below is a quick example of some code you can use to perform an action in a background app periodically.

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <script src="https://static.zdassets.com/zendesk_app_framework_sdk/2.0/zaf_sdk.min.js"></script>
    <script>
    const client = ZAFClient.init();

    const periodicFunction = () => {
    console.log('This is an action')
    };

    client.on('app.registered', () => {
    setInterval(periodicFunction, 10000);
    });
    </script>
    </body>
    </html>
    You'll just need to remember to set the location to Background in the manifest.json file
     
    Hope this helps!
    0
  • DAVID BERUMEN LOZANO
    Comment actions Permalink

    excellent it worked very well for me. You can give me the tutorial to create an app that is not in the tickets but in the top bar 

    0
  • Zach Anthony
    Comment actions Permalink

    Hey David,

    We don't have any specific tutorials for developing an app for the top bar location, however it is very similar to the process you have followed for a sidebar app. You will just need to update your manifest file to refer to the top_bar location and check the objects and events available in this location in our documentation

    0
  • DAVID BERUMEN LOZANO
    Comment actions Permalink

    Thank you, you are helping me a lot. Finally, I would like to activate this listener when the page loads inside top_bar:
    <script>
    constant client = ZAFClient.init ();

    periodic function const = () => {
    console.log ('This is an action')
    };

    client.on ('app.registered', () => {
    setInterval (periodicFunction, 10000);
    });
    </script>

    Is there an event within the top bar that runs every time zendesk support loads ?.

    0
  • Eric Nelson
    Comment actions Permalink

    Hey David,

    You can just use a standard 'onload' to accomplish this. This MDN documentation may be useful to you.

    Have a wonderful day!

    Eric Nelson | Manager - Developer Advocacy

    0

Please sign in to leave a comment.

Powered by Zendesk