Reputation: 21
This year, SAP CAI started with a new Policy and the form to connect TWILIO with SAP CAI has changed definitely. I've tried for more than 4 days to do it but I haven't managed to do it yet.
I would like to know the process to send and return an answer from SAP CAI to TWILIO using webhook. The code you find on the intenet, is not working anymore:
exports.handler = function(context, event, callback) {
const twiml = new Twilio.twiml.MessagingResponse();
var sapcai = require('sapcai');
var build = new sapcai.build('API_TOKEN', 'LANGUAGE');
build.dialog({
type: 'text',
content: event.Body
}, {
conversationId: '+NUMBER_'
}).then(function(res) {
data = res.messages[0].content;
twiml.message(data);
callback(null, twiml);
})
}
Anybody has managed to code this to know how to do it?
It would be awesome to use an example in Postman to return an answer from SAP CAI to Twilio using this webhook.
Upvotes: 0
Views: 104