6️Callbacks

1. Imported callback

This callback will be executed after the contacts are imported

SocialInviter.set({
    authUrl: {
        development: 'http://127.0.0.1:5501/oauth.html',
        stage: 'https://stage.yourdomain.com/oauth.html',
    },
    style: {
        'font-family': 'Arial'
    },
    callbacks: {
        imported: (service, profile, addressbook) => {
            console.log('service', service);
            console.log('addressbook', addressbook);
        }
    }
});

2. Proceed callback

This callback will be executed once a user clicks on the "Proceed" button on the contacts screen

SocialInviter.set({
    authUrl: {
        development: 'http://127.0.0.1:5501/oauth.html',
        stage: 'https://stage.yourdomain.com/oauth.html',
    },
    style: {
        'font-family': 'Arial'
    },
    callbacks: {
        proceed: (service, profile, addressbook, selected) => {
            console.log('service', service);
            console.log('addressbook', addressbook);
        }
    }
});

3. Send callback

This callback will be executed after the user clicks the "Send" button on the mail screen

SocialInviter.set({
    authUrl: {
        development: 'http://127.0.0.1:5501/oauth.html',
        stage: 'https://stage.yourdomain.com/oauth.html',
    },
    style: {
        'font-family': 'Arial'
    },
    callbacks: {
        send: (service, profile, addressbook, selected, successObjects, errorObjects) => {
            // Your logic here
        }
    }
});

4. Service invite button callback

SocialInviter.set({
    authUrl: {
        development: 'http://127.0.0.1:5501/oauth.html',
        stage: 'https://stage.yourdomain.com/oauth.html',
    },
    style: {
        'font-family': 'Arial'
    },
    callbacks: {
        button: (product, service, e, profile, addressbook, selected) => {
            // Your logic here
        }
    }
});

5. Full example

You can use imported, proceed, send callback methods to receive the callback execution.

SocialInviter.set({
    authUrl: {
        development: 'http://127.0.0.1:5501/oauth.html',
        stage: 'https://stage.yourdomain.com/oauth.html',
    },
    style: {
        'font-family': 'Arial'
    },
    callbacks: {
        imported: (service, profile, addressbook) => {
            console.log('service', service);
            console.log('addressbook', addressbook);
        },
        proceed: (service, profile, addressbook, selected) => {
            console.log('service', service);
            console.log('addressbook', addressbook);
        },
        send: (service, profile, addressbook, selected, successObjects, errorObjects) => {
            console.log('service', service);
        },
        button: (product, service, e, profile, addressbook, selected) => {
            // Your logic here
        }
    }
});

Last updated