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:
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.
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 and dashbotApiKey set up, you’re ready to integrate the log calls into your actions code.
1. 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);