Webchat systems facilitate real-time customer-business communication. Analysis of chat logs reveals common customer inquiries and sentiment, informing customer service strategies and webchat design.
Welcome to the Webchat documentation for Dimension! Integrating Dimension into your Webchat application is quick and easy.
If you have any questions, comments, or suggestions, please feel free to contact us.
Node Integration
Create a bot API key
Each bot needs its own API key for tracking.
Create a bot to get an API key.
Install Dimension via NPM
npm install --save dimensionlabs
Include Dimension
Use the API key created above.
const dimension = require('dimension')(process.env.DIMENSION_API_KEY).webchat;
Whenever your bot sends or receives data, log to Dimension
You can send the following fields:
- text – string – (required)
- userId – string – (required) – should be the SAME userId for both incoming and outgoing messages this is NOT the bot’s user ID
- intent – object – (optional)
- name – string
- inputs – array
- input – object
- name – string
- value – string
- input – object
- images – array – (optional)
- image – object
- url – string
- image – object
- buttons – array – (optional)
- button – object
- id – string
- label – string
- value – string
- button – object
- postback – object (optional)
- buttonClick – object
- buttonId – string
- buttonClick – object
- platformJson – object (optional) – send ALL of your platform-specific JSON here. It will be available for viewing in your transcripts.
Log whenever you receive a message:
const messageForDimension = {
"text": "Hi, bot",
"userId": "USERIDHERE123123",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
};
dimension.logIncoming(messageForDimension);
Log whenever you send a message:
const messageForDimension = {
"text": "Hello, my human pet",
"userId": "USERIDHERE123123",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
};
dimension.logOutgoing(messageForDimension);
REST Integration
Create a bot API key
Each bot needs its own API key for tracking.
Create a bot to get an API key.
Integrate the REST API
Use the API key created above.
You can send the following fields:
- text – string – (required)
- userId – string – (required) – should be the SAME userId for both incoming and outgoing messages this is NOT the bot’s user ID
- intent – object – (optional)
- name – string
- inputs – array
- input – object
- name – string
- value – string
- input – object
- confidence – float (optional) - the confidence value for your intent from 0.0 (completely uncertain) to 1.0 (completely certain)
- images – array – (optional)
- image – object
- url – string
- image – object
- buttons – array – (optional)
- button – object
- id – string
- label – string
- value – string
- button – object
- postback – object (optional)
- buttonClick – object
- buttonId – string
- buttonClick – object
- platformJson – object (optional) – send your platform-specific message JSON here. It will be available for viewing in your transcripts. Reporting on this data is available with our enterprise plan.
- platformUserJson – object (optional) – send any user-specific information (ie. zipcode, A/B test group, etc). Reporting on this data is available from audience builder, with our enterprise plan.
When your bot receives a message, POST to this endpoint:
https://tracker.dimensionlabs.io/track?platform=webchat&v=11.1.0-rest&type=incoming&apiKey=API_KEY_HERE
Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE
with your api key.
The data to POST should pass the following data:
{
"text": "Hi, bot",
"userId": "USERIDHERE123123",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
}
When your bot sends a message, POST to the tracker endpoint:
{
"text": "Hello, my human pet",
"userId": "USERIDHERE123123",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
}