I'm using Recast.ai NLP Platform.I have create a simple bot on recast.ai console.Now,i want store my messages on MongoDb database.I have create a simple post type API for to save information on MongoDB. But i got stuck how to integrate or how to this from console.
My code for API :
app.post("/addname", (req, res) => {
console.log("called");
var myData = new User(req.body);
myData.save()
.then(item => {
res.send("Name saved to database");
})
.catch(err => {
res.status(400).send("Unable to save to database");
});
});
The format that you are receiving from the Bot Builder is the JSON that you have on this page (Body configuration) https://cai.tools.sap/docs/concepts/code-and-webhook you should then store the nlp.source to get the message the user sent. In order to answer back the builder you need to answer with a JSON that is compliant with what the builder is expecting, the list of messages are listed here: https://cai.tools.sap/docs/concepts/structured-messages so you should probably send