One way to integrate Dativery in you application is to use our JS API.

Here is tutorial how to do that:

<script src="https://integrate.dativery.com/api/v1/integrate.js" />

<!-- we will put content into this box -->
<div id="box"></div>

Initialize the library (called only once on a page):

var pz = new Dativery({
   app: 'com.gmail', // application identification
});

var integration = pz.integrate('#box'); // integrate in div with ID ‘box’

You need to invoke event that will tell Dativery what the user is looking on. If the context of the page changes (user selects another item), the event has to be called again.

/* this will enable integration using URL mapping in Dativery */
integration.integrateByURL();

You can also provide directly what user is looking on:

/* this will invoke event, but data are read thru app's API */
integration.invokeEvent({
    entityDef: 'com.gmail.threads',
    operation: 'view',
    key: '157d2a0e7e0244b0',
});

Or you can directly provide the data to Dativery:

/* this will invoke event, but data are provided directly in the page */
integration.invokeEvent({
    entityDef: 'com.dativery.model.entities.contacts',
    operation: 'view',
    key: '123',
    data: {
        'com.dativery.model.entities.contacts@firstname': 'John',
        'com.dativery.model.entities.contacts@surname': 'Doe',
    },
});

If you are interested in this API, contact us.