Plugin SDK > Execute code on boot

    Execute code on boot

    There are situations where a plugin needs to execute code as soon as the DatoCMS interface is loaded. For example, a plugin may need to contact third party systems to verify some information, or maybe notify the user in some way.

    In these scenarios you can use the onBoot hook, and have the guarantee that it will be called as soon as the main DatoCMS application is loaded:

    import { connect } from 'datocms-plugin-sdk';
    connect({
    async onBoot(ctx) {
    ctx.notice('Hi there!');
    }
    });

    Inside this hook there is no point in rendering anything, because it won't be displayed anywhere. For a concrete use case of this hook, please have a look at the chapter Releasing new plugin versions.


    onBoot

    This function will be called once at boot time and can be used to perform ie. some initial integrity checks on the configuration.

    Properties available in context

    The following information and methods are available:

    Methods available in context

    The following information and methods are available: