asterai-api-bot-writer
v1.0.4
Published
SDK library that provides integration API for AsterAI service.
Maintainers
Readme
AsterAI JS library for server side node.js app
Use this library to integrate AsterAI bot writer services.
1. Get API HASH code at http://asterai.com/operator/
2. install lib
npm install asterai-api-bot-writer --save 3. Put this demo into your project
const BotWriter = require( 'asterai-api-bot-writer').BotWriter;
const botWriter = new BotWriter(
'<API HASH>', // get this API HASH on http://asterai.com/operator/
'showcase:domestic_chemical_default' // get this System on bots page at http://asterai.com/operator/
);
// Please use this model for example of data structures that bot understand
const demoModel = {
"name": "Some shampoo",
"class": "shampoo",
"brand": "american_crew",
"model": "Classic",
"internalID": "6",
"attributes": [
{
"attribute": "consumer:budget",
"value": "prof"
},
{
"attribute": "volume",
"value": "1"
},
{
"attribute": "country",
"value": "usa"
}
]
};
// Send command to bot to write an article ant get it as result
botWriter.writeArticle(demoModel)
.then(result => {
console.log(result);
})
.catch(message => {
console.error('Something goes wrong: ', message);
});