Type: BYOB Worker
A BYOB worker takes user input and sends it over the ServisBOT BaaS to an external application for processing. This means that any service that can accept or responde in natural language, and can be accessed over API calls, can be used as a bot inside ServisBOT. A BYOB worker can be created through the CLI or through the Add Resource
button on a bot’s detail page.
Save this json to a file and create a worker using the cli command sb-cli worker create file.json
{
"Config": {},
"Data": {
"api": "some-baas-alias",
"newConversationApi": "some-baas-alias",
"nluConfidenceThresholdOverride": 0.8,
"fallbackConfiguration": {
"regexes": ["\\w+", "sorry can you repeat that"]
}
},
"Description": "Sage maker worker",
"Enabled": true,
"Name": "MikesByobWorker",
"Status": "published",
"Type": "r2-byob-worker"
}
The BYOB worker will call an API connector with a message
. The worker will expected at message
back with an optional confidence score
Call to API Connector
{
message: 'response from external api'
}
Response back from API Connector
{
message: 'Client message / utternace',
confidence: 80
}
You will also need a BAAS Api configured below in order for the worker to successfully talk to an external API.
{
"Alias": "ByobApi",
"Endpoint": "https://some-url",
"RequestMapping": {
"Message": {
"type": "requestBody",
"inputPath": "$.message",
"requestBodyPath": "$.message"
}
},
"ResponseMapping": {
"Message": {
"type": "responseBody",
"responseBodyPath": "$.message",
"outputPath": "$.message"
}
},
"Headers": {},
"Method": "POST",
"Body": {}
}
Once you have created the worker using the CLI, it will return an ID for you. You need to then update/create a bot and place the filter worker at the top with the id and the type of r2-byob-worker