@converseai/plugins-sdk
v1.3.1
Published
This library makes it easy to create your own plugins and modules for the Converse AI platform.
Downloads
32
Keywords
Readme
Converse Plugins SDK
This library makes it easy to create your own plugins and modules for the Converse AI platform
Setup Instructions
Converse Plugins SDK
- Import the appropriate class(es):
let ConversePluginsSDK = require('@converseai/plugins-sdk');
- Create an http instance:
const app = new ConversePluginsSDK.http({request: request, response: response});
Example Using Express
Javascript
Below is a simple delay module that will delay the conversation.
delayTime
is created via the module definition on the ConverseAI platform. If it's undefined then it will delay for 1 second.
const express = require('express')();
const Status = require('@converseai/plugins-sdk').Status;
express.use(bodyParser.json());
var delayModule = function(app, body) {
setTimeout(function() {
app.send(Status.SUCCESS);
}, body.payload.moduleParam.delayTime || 1000);
}
express.post('/', function (request, response) {
var app = new ConversePluginsSDK.http({ request, response });
app.setModules({
delayModule: delayModule
});
app.handleRequest();
});
License
See LICENSE