To integrate your Bixby Capsule with Dashbot, use the Universal REST integration — here are detailed instructions on how to do this.
Create a bot API key
Each bot needs its own API key for tracking.
For Bixby capsules, select the “Universal” platform. Create a bot to get an API key.
Integrate the REST API
Until Bixby supports NPM modules, you’ll need to create your own “dashbot-lib” within your capsule to send messages to Dashbot.
We have created one here, that you can use:
In order for this library to work, you’ll need to set up a few things:
\$vivContext The Dashbot REST API requires only two things, user ID and text. To get the proper user ID for Bixby capsules, we’ll need to get it from \$vivContext. As shown in the Bixby User Context Sample, to get access to \$vivContext, you will need to add it to endpoints.bxb as accepted-inputs.
capsule.bxb To get access to the Bixby user id, you need to enable this permission in your capsules. To do so, you need to add bixby-user-id-access to the permissions portion of your capsule.bxb — you can see this in our example here:
secret.get(‘dashbotApiKey’); In order for dashbot-lib to work, you’ll need the API key you created in the previous step. You should use the Bixby Secrets to store your Dashbot API Key.
For more information about how to store & retrieve secrets, please refer to the Bixby Secrets Documentation.
Once you have \$vivContext, bixby-user-id-access and dashbotApiKey set up, you’re ready to integrate the log calls into your actions code.
- When your capsule receives a message
When your capsule receives a message, in your actions code, you should add the following line:
dashbot.logIncoming("text here", "intent name", $vivContext, platformJson);
Using that function call, you can customize the text, intent name and any useful JSON you want to send to Dashbot.
2. When your capsule sends a message
When your capsule sends a response, you may use the following call:
dashbot.logOutgoing("text here", "intent name", $vivContext, platformJson);
View a complete example.