Integrate with Dimension using a REST integration

Using the Universal integration, you can use Dimension with any conversational user interface.

Create an API key

Here is a quick video guide on how to generate you Dimension API keys

There are two integration points as outlined below. Before diving into the integration points, the message format section describes the payload you will be logging to Dimension.


Message Format

You can send the fields listed in the "Formatting your data" section with the following as an example:

{
  text: "I'd like to place an order for a pizza using 1 bitcoin",
  userId: "user01",
  intent: {
    name: "Order",
    inputs: [{
      name: "Dish",
      value: "Pizza"
    }, {
      name: "Payment",
      value: "1 bitcoin"
    }],
    confidence: 1.0
  },
  images: [
    "https://i.example.com/orders/pizza.png"
  ],
  buttons: [{
    id: "=ay13.x",
    label: "Pizza",
    value: "pizza"
  }, {
    id: "=asdf2",
    label: "Drink",
    value: "drink"
  }],
  postback: {
    buttonClick: {
      buttonId: "=ay13.x"
    }
  },
  platformJson: {},
  platformUserJson: {},
  sessionId: "1"
}

1. When your bot receives a message

When your bot receives a message, post the data to the following endpoint:

https://tracker.dimensionlabs.io/track?platform=universal&v=10.1.1-rest&type=incoming&apiKey=API_KEY_HERE

Make sure to set the ‘Content-Type’ header to ‘application/json’ and replace API_KEY_HERE with your api key.


The data to POST should pass the following data:

{
  "text": "Hi, bot",
  "userId": "USERID_01",
  "platformJson": {
    "whateverJson": "any JSON specific to your platform can be stored here"
  }
}

Sample cURL

curl -X POST -H "Content-Type: application/json" <br></br>
-d '{"text":"Hi, bot","userId":"USERIDHERE123123","platformJson":{"whateverJson":"any JSON specific to your platform can be stored here"}}' <br></br>
'https://tracker.dimensionlabs.io/track?platform=universal&v=11.1.0-rest&type=incoming&apiKey=API_KEY_HERE'

Notice, you must replace the placeholder API_KEY_HERE above with your api key.

Note: This is just an example — we accept all the fields listed at the top of the page.


2. When your bot sends a message

When your bot sends a message, POST to the following endpoint:

https://tracker.dimensionlabs.io/track?platform=universal&v=11.1.0-rest&type=outgoing&apiKey=API_KEY_HERE

Make sure to set the ‘Content-Type’ header to ‘application/json’ and replace API_KEY_HERE with your api key.


The data to POST should pass the following data:

{
  "text": "Hello, my human pet",
  "userId": "USERIDHERE123123",
  "platformJson": {
    "whateverJson": "any JSON specific to your platform can be stored here"
  }
}

Sample cURL

curl -X POST -H "Content-Type: application/json" <br></br>
-d '{"text":"Hello, my human pet","userId":"USERIDHERE123123","platformJson":{"whateverJson":"any JSON specific to your platform can be stored here"}}' <br></br>
'https://tracker.dimensionlabs.io/track?platform=universal&v=11.1.0-rest&type=outgoing&apiKey=API_KEY_HERE'

Notice, you must replace the placeholder API_KEY_HERE above with your api key.


Sample JSON with optional fields

{
  "text": "Hello, my human pet",
  "userId": "USERIDHERE123123",
  "intent": {
    "name": "HELLO"
  }, 
  "images": [{
    "url": "https://media.giphy.com/media/mIZ9rPeMKefm0/giphy.gif"
  }],
  "platformUserJson": {
    "firstName": "Will",
    "lastName": "Robinson",
    "locale": "en_US",
    "timezone": "-8",
    "gender": "male"
  },
  "platformJson": {
    "whateverJson": "any JSON specific to your platform can be stored here"
  }
}

Note: This is just an example — we accept all the fields listed at the top of the page.


Example

View a complete example.