1. Help Center
  2. Chat Widgets
  3. General, scripts and versions

Interaction Data

Interaction Data

Sometimes you will want to push interaction data from an object on the page, or from GET parameters, passed through the URL. The interaction data API allows you to push any data into your interaction. 


The interaction data you pass in may correlate to the data collection fields, or may be completely separate from this. 


The interaction data API is available after the scripts have loaded, to help determine when the scripts have completed loading, you may hook into our custom config callback:

window.talkativeCustomConfig = {
events: {
enterStandby() {
const someData = [
{
name: 'ticket'
data: 'T1234',
label: 'Ticket Reference',
type: 'string'
},
{
name: 'reference',
data: 'C5678',
label: 'Customer Reference',
type: 'string'
}
];

window.talkativeApi.interactionData.appendInteractionData(someData);

},
}
};

The above example loads the interaction data within the talkativeCustomConfig callback under the enterStandby()


You can populate this array from other examples, including pulling data from the get parameters and then mapping this into an array. Each object in the array should have the data itself, a label describing the data, and  the type of data, the type being a JavaScript type.