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

Here is tutorial how to do that:

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

<!– we will put content into this box –>
<div id="box"></div>
[/html]

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

[code language=”js”]
var pz = new Dativery({
app: ‘com.gmail’, // application identification
});

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

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.

[code language=”js”]
/* this will enable integration using URL mapping in Dativery */
integration.integrateByURL();
[/code]

You can also provide directly what user is looking on:

[code language=”js”]
/* this will invoke event, but data are read thru app’s API */
integration.invokeEvent({
entityDef: ‘com.gmail.threads’,
operation: ‘view’,
key: ‘157d2a0e7e0244b0’,
});
[/code]

Or you can directly provide the data to Dativery:

[code language=”js”]
/* 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’,
},
});
[/code]

If you are interested in this API, contact us.