supportive-js

1.1.4 • Public • Published

Supportive.js

A vanilla, dependency-free browser JS library for the Supportive.io API.

Read the full documentation here.

Install

Via bower:

bower install --save supportive-js

Via npm:

npm install --save supportive-js

Via Download:

Download latest version from Github


Quick Start

1. Add the script to your page.

<script type="application/javascript" src="<path_to_supportive_js>/supportive.js"></script>

2. Prepare Supportive.js.

var support = new Supportive( 'your_app_id', 'your_api_token' );

3. Initialise Supportive.io.

var user =  {
                identifier  : 'ashheskes',
                email       : 'ash@supportive.io',
                name        : 'Ash Heskes',
                custom_data :
                    {
                        test : true
                    }
            };

support. init( user, function( error, user, messages ) {

    if ( error ) return alert( ':( Something went wrong!' );

    /* do stuff... */
} );

4. Listen for new messages.

support. on( 'message', function( message ) {
    
    /* do stuff... */
} );

5. Send a support message.

support. once ( 'init', function (  ) {
    
    support. send( 'Feedback!', 'I love your App.', { page : 'home' }, function( error, message ) {

        if ( error ) return alert( ':( Something went wrong!' );
        
        /* do stuff... */
    } );
} );

Package Sidebar

Install

npm i supportive-js

Weekly Downloads

6

Version

1.1.4

License

MIT

Last publish

Collaborators

  • ashheskes