Google Integration with @assistant/conversation

Irrespective of how you deploy your webhook handler (via firebase or url), if you use the @assistant/conversation, you can integrate with Dashbot in the following manner.

Create a bot API key

Each bot needs its own API key for tracking.

Create a bot to get an API key.

Install Dashbot via NPM

npm install --save dashbot

Include Dashbot

Use the API key created above.

const dashbot = require('dashbot')(process.env.DASHBOT_API_KEY).google;

After creating an Conversation object, pass it to Dashbot

const { conversation } = require('@assistant/conversation');
const app = converastion();
app.handle('greeting', conv => {

Custom User Metadata

In order to include custom user metadata such as user IDs, that you would like to see on the Dashbot platform, stringify a JSON object on the dashbot key in the user params section of the conversation object in an intent handler.

For example, the conversation object in the intent handler should look like the following:

app.handle('greeting', conv => {
let message = 'Hi!';
if (!conv.user.lastSeenTime) {
message = 'Welcome back!';
conv.user.params.dashbot = "{\"dashbotUser\":{\"userId\":\"USER ID HERE\"}}"