Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
botkit-studio-sdk
Advanced tools
An SDK for integrating Botkit Studio's trigger and script management APIs into a bot
Botkit Studio is a hosted development tool for bot builders. Botkit Studio will substantially ease the development and deployment of a Bot, help to avoid common coding pitfalls, and provide a valuable management interface for the bot's dialog content and configuration. Botkit Studio is a product of Howdy.ai, the creators of Botkit.
This SDK allows developers to use the Botkit Studio APIs without using Botkit. This is useful for bot developers who have existing apps but would benefit from features like bot-specific content management.
Install the SDK from npm:
npm install --save botkit-studio-sdk
First, register for a developer accont with Botkit Studio and acquire an API token. This will identify your bot and grant your application access to the APIs.
In your bot application, include the library and create an API client:
var BKS = require('botkit-studio-sdk');
var bks_client = new BKS({
studio_token: 'studio token from botkit studio goes here'
});
Argument | Description |
---|---|
input_text | This is the input string you want to evaluate for possible triggers. |
user_id | A unique user id representing the user whose input is being evaluated |
This function uses Botkit Studio's trigger API to test input text against all of a bots configured triggers. If a trigger is matched, the matching script will be returned as a JSON object. Otherwise, an empty object will be returned.
Function returns a promise.
var BKS = require('botkit-studio-sdk');
var bks_client = new BKS({
studio_token: 'studio token from botkit studio goes here'
});
bks_client.evaluateTrigger('hello how are you', user_id).then(function(script_object) {
// will always return a script_object.
// if it couldnt find a script the script_object will be an empty object
if (script_object.command) {
// a trigger was matched, do something...
// ... interpret the script object
} else {
// no matching trigger
}
}).catch(function(err) {
// an error occured while using the BKS API
});
Argument | Description |
---|---|
script_name | The name of a script that exists in Botkit Studio |
user_id | A unique user id representing the user whose input is being evaluated |
Returns a promise that, when resolved, receives a JSON object representing the script identified by script_name.
var BKS = require('botkit-studio-sdk');
var bks_client = new BKS({
studio_token: 'studio token from botkit studio goes here'
});
bks_client.getScript('thanks', user_id).then(function(script_object) {
// will always return a script_object.
// if it couldnt find a script the script_object will be an empty object
// interpret script object
if (script_object.command) {
// a trigger was matched, do something...
// ... interpret the script object
} else {
// no matching trigger
}
}).catch(function(err) {
});
A script JSON object from Botkit Studio API should look something like this:
{
"command":"hello",
"description":"Respond when a human says hello!",
"triggers":[
{
"type":"string",
"pattern":"hello"
},
{
"type":"string",
"pattern":"hey"
},
{
"type":"string",
"pattern":"hi"
},
{
"type":"string",
"pattern":"howdy"
}
],
"variables":[
],
"script":[
{
"topic":"default",
"script":[
{
"text":[
"Hello Human!",
"How do you do?",
"Nice to meet you Human.",
"Hi!",
"How’s it going?",
"Hey!",
"Hey there!",
"Howdy!",
"G`day human!",
"Salut!",
"Ciao!",
"Hola!",
"Shalom!"
]
},
{
"text":[
"You can edit it to customize my behaviors."
]
},
{
"action":"complete"
}
]
}
]
}
FAQs
An SDK for integrating Botkit Studio's trigger and script management APIs into a bot
The npm package botkit-studio-sdk receives a total of 2,008 weekly downloads. As such, botkit-studio-sdk popularity was classified as popular.
We found that botkit-studio-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.