Client library for Pandorabots AIaaS
npm install --save @datafire/pandorabots
let pandorabots = require('@datafire/pandorabots').create({
user_key: ""
});
.then(data => {
console.log(data);
});
AIaaS provides API access to our bot hosting platform and SDKs, allowing developers to easily integrate conversational interfaces into applications.
Start a conversation with the bot using the Anonymous Talk API. This method will allow you to request creation of an end-user client_name that can maintain persistent predicates per end-user talking to your bot. If client_name is NOT sent in the request, then Pandorabots will create a end-user client_name and return it in the response. Similar to the Talk to Bot API, Pandorabots will also return a new session ID if not included in the call. Use the session ID returned to group interactions together.
In addition to bot response and session ID, the HTTP response will include a new end-user client_name in the following format:
aiaas-XXX-user-nnnn, where XXX is your app_ID and nnnn is numeric starting with 0000 and incrementing after each request.
Malformed requests such as exceeding size of input or unknown end-user client_name returns 400 error code. Error code 412 is returned if the bot is not compiled or does not exist. Error code 429 is returned if your application has reached maximum plan API call limit.
curl -v -X POST 'https://aiaas.pandorabots.com/atalk/APP_ID/BOTNAME?user_key=USER_KEY&input=INPUT'
pandorabots.atalkBot({
"app_id": "",
"botname": "",
"input": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: The name of the bot. Format required is 3-64 characters in length and only numbers or lower-case letters [0-9][a-z] - input required
string
: Message to be sent to the bot. This can contain multiple sentences. Currently the limit is 500 characters. - client_name
string
: Leave blank to request Pandorabots to create a client_name which will support persistent predicates. Including a valid client_name in this parameter will work in the same way that Talk to Bot API but with persistent predicates. It is recommended to use this API only to create an end-user client_name, and then use normal Talk to Bot API to continue conversation with the bot. - sessionid
string
: Session ID generated by Pandorabots. This allows the application to group individual conversations into a collection as needed. If not included in the call, Pandorabots will issue a new session ID. (4-byte integer type) - recent
string
: If true, the system will not signal an error if the bot is uncompiled, and will instead look for a previous version of the bot that is available.
- app_id required
Output schema unknown
Retrieve a list of your application's bots. Response returns JSON object with info for each bot.
Returns a 401 error code for invalid app_ID or user_key, or if applicable, invalid referrer.
curl -v -X GET 'https://aiaas.pandorabots.com/bot/APP_ID?user_key=USER_KEY'
pandorabots.listBots({
"app_id": ""
}, context)
- input
object
- app_id required
string
: Your Application ID
- app_id required
Output schema unknown
Delete a bot on the Pandorabots server.
Deleting a bot that does not exist returns a 412 error. Invalid botname will return a 400 error. Invalid app_id, user_key, or referrer filter will return a 401 error.
curl -v -X DELETE 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME?user_key=USER_KEY'
pandorabots.deleteBot({
"app_id": "",
"botname": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Name of the bot to delete.
- app_id required
Output schema unknown
Retrieve a list of a bot's files. Returns a JSON object with each bot file associated with bot specified.
Returns a 404 error code for bot not found. Returns a 401 error code for invalid app_ID, user_key, or referrer filter.
The return=zip
option may not behave as expected using Active Docs 1.2
curl -v -X GET 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME?user_key=USER_KEY'
pandorabots.listBotFiles({
"app_id": "",
"botname": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: The name of the bot. - return
string
: If set to zip, a zip file with all bot files will be returned.
- app_id required
Output schema unknown
Create a new instance of a bot on the Pandorabots server.
If there is already a bot under the same app_id and botname, a 409 error is returned. Invalid botname will return a 400 error.
Creating more bots than your plan allows or using an invalid app_id or user_key (or if applicable referrer filter) returns a 401 error.
curl -v -X PUT 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME?user_key=USER_KEY'
pandorabots.createBot({
"app_id": "",
"botname": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Must be unique from all the other bots you have created under this app_id. Can only be numbers and lowercase letters, and must be between 3 and 64 characters long.
- app_id required
Output schema unknown
A bot personality is created by uploading AIML and other file types to Pandorabots. The files must compile correctly in order for the bot to run. By issuing a call to this API, Pandorabots will compile the bot, updating any changes that have been made to the files.
Compiling the bot makes its most recent version available for talk. A 400 error means that we were unable to compile your bot (you should check your files for syntax issues) or the botname was not found.
You can see any thrown errors in the results field of the returned JSON object:
curl -v -X GET 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME/verify?user_key=USER_KEY'
pandorabots.compileBot({
"app_id": "",
"botname": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Your bot's name
- app_id required
Output schema unknown
Delete pdefaults or properties bot file.
For malformed file-kind, a 404 error is returned. For invalid botname, a 412 error is returned.
curl -v -X DELETE 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME/FILE-KIND?user_key=USER_KEY'
pandorabots.deleteBotFile2({
"app_id": "",
"botname": "",
"file-kind": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Name of the bot. - file-kind required
string
: Specify the type of file being deleted: pdefaults, properties
- app_id required
Output schema unknown
Retrieve pdefaults or properties bot file.
For malformed file-kind, a 404 error is returned. For invalid botname, a 400 error is returned. For unknown bot or file, a 412 error is returned.
curl -v -X GET 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME/FILE-KIND?user_key=USER_KEY'
pandorabots.getBotFile2({
"app_id": "",
"botname": "",
"file-kind": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Name of the bot. - file-kind required
string
: Specify the type of file being retrieved: pdefaults, properties
- app_id required
Output schema unknown
Upload bot personality files to your bot. Files must be named with only lowercase letters and numbers with one of the following extensions:
Properties: Extension - .properties, file-kind - properties, No filename required in path
Predicate defaults: Extension - .pdefaults, file-kind - pdefaults, No filename required in path
The system will overwrite existing files with the file being uploaded.
For malformed JSON in non-AIML files, a 400 error is returned. For malformed file-kind, a 404 error is returned. For invalid file or botname, a 412 error is returned.
If Active Doc spec is not working with this API, please use the following curl command examples:
curl -v -X PUT 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME/properties?user_key=USER_KEY'
--data-binary @/home/foo/foobot.properties
pandorabots.uploadFile2({
"app_id": "",
"botname": "",
"file-kind": "",
"content": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Your bot's name - file-kind required
string
: Specify the type of file being uploaded: pdefaults, properties - content required
string
- app_id required
Output schema unknown
Delete an AIML, set, map or substitution bot file
For malformed file-kind, a 404 error is returned. For invalid file or botname, a 412 error is returned.
curl -v -X DELETE 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME/FILE-KIND/FILENAME?user_key=USER_KEY'
pandorabots.deleteBotFile1({
"app_id": "",
"botname": "",
"file-kind": "",
"filename": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Name of the bot. - file-kind required
string
: Specify the type of file being deleted: file (for AIML files), map, substitution, set - filename required
string
: Filename to delete. Note: for non-AIML files, do not include the file extension in the path.
- app_id required
Output schema unknown
Retrieve an AIML, set, map or substitution bot file.
For malformed file-kind, a 404 error is returned. For invalid filename or botname, a 400 error is returned. For unknown bot or file, a 412 error is returned.
curl -v -X GET 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME/FILE-KIND/FILENAME?user_key=USER_KEY'
pandorabots.getBotFile1({
"app_id": "",
"botname": "",
"file-kind": "",
"filename": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Name of the bot. - file-kind required
string
: Specify the type of file being retrieved: file (for AIML files), map, substitution, set - filename required
string
: Filename to retrieve. Note: for non-AIML files, do not include the file extension in the path.
- app_id required
Output schema unknown
Upload bot personality files to your bot. Files must be named with only lowercase letters and numbers with one of the following extensions:
AIML: Extention - .aiml, file-kind - file
Sets: Extension - .set, file-kind - set
Maps: Extension - .map, file-kind - map
Substitutions: Extension - .substitution, file-kind - substitution
The system will overwrite existing files with the file being uploaded.
If the request is malformed because the file name is invalid or malformed JSON for non-AIML files, a 400 error is returned. For malformed file-kind, a 404 error is returned. For invalid file or botname, a 412 error is returned.
If Active Doc spec is not working with this API, please use the following curl command examples:
curl -v -X PUT 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME/file/foobot.aiml?user_key=USER_KEY'
--data-binary @/home/foo/foobot.aiml
curl -v -X PUT 'https://aiaas.pandorabots.com/bot/APP_ID/BOTNAME/set/colors?user_key=USER_KEY'
--data-binary @/home/foo/colors.set
pandorabots.uploadFile1({
"app_id": "",
"botname": "",
"file-kind": "",
"filename": "",
"content": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: Your bot's name - file-kind required
string
: Specify the type of file being uploaded: file (for AIML files), map, substitution, set - filename required
string
: Filename to upload, must be named with only lowercase letters and numbers. Note: for non-AIML files, do not include the file extension in the path. - content required
string
- app_id required
Output schema unknown
Use these tools to test/debug/trace bot categories.
Malformed requests such as exceeding size of input or invalid clientname returns 400 error code. Error code 412 is returned if the bot is not compiled or does not exist.
curl -v -X POST 'https://aiaas.pandorabots.com/talk/APP_ID/BOTNAME?user_key=USER_KEY&input=INPUT'
pandorabots.debugBot({
"app_id": "",
"botname": "",
"input": ""
}, context)
- input
object
- app_id required
string
: Your Application ID - botname required
string
: The name of the bot. Format required is 3-64 characters in length and only numbers or lower-case letters [0-9][a-z] - input required
string
: Message to be sent to the bot. This can contain multiple sentences. Currently the limit is 500 characters. - client_name
string
: Identifies your application's end user. You can assign each of your end users a unique client_name. This will allow you to set predicates and other variable information that is specific to an individual. Format required is 3-64 characters in length and only numbers or lower-case letters [0-9][a-z] - sessionid
string
: Session ID generated by Pandorabots. This allows the application to group individual conversations into a collection. While testing your bot, not including this parameter, Pandorabots will issue a new session ID. (4-byte integer type) - that
string
: For debugging purposes, you can specify a 'that' with the input that supersedes the existing that in bot memory. - topic
string
: For debugging purposes, you can specify a 'topic' with the input that supersedes the existing topic in bot memory. - extra
string
: Return extra conversation information. If true, input, pattern, that, topic, filename, and template associated with the pattern matched are returned in addition to response and sessionid. - reset
string
: Reset the bot memory. If true, all predicate values in the bot will be discarded, and the user can talk to the bot as if it is the first time - trace
string
: Include trace data in the response. If true, the system will generate AIML trace information for the input. Trace data includes pattern matched, filename, input, template for all recursion levels. NOTE: for security reasons, trace does not work with client_name. - reload
string
: If true, the system will force a reload of the bot into memory. This can be useful if you've recently uploaded an AIML file, recompiled your bot and want access to your bot's latest changes. - recent
string
: If true, the system will not signal an error if the bot is uncompiled, and will instead look for a previous version of the bot that is available.
- app_id required
Output schema unknown
This integration has no definitions