You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.
I would appreciate any suggestions to help resolve the issue i am currently experiencing (Please see generated error in attached file). Everything seemed to be working fine till a few weeks ago. I use the sdk to receive and send messages to a SAP chatbot as shown in the code below. I keep getting an unauthorised error even after trying with both the designtime and runtime oauth credentials.
let token = process.env.SAPCAI_TOKEN;
let client = new sapcai.connect(token);
let app = express();
const jsonParser = bodyParser.json();
app.use(cors());
app.use(jsonParser);
app.use(express.static('customwidget'));
app.use(serveStatic(path.join(__dirname, '/../sapcaiWidget')));
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*"); // update to match the domain you will make the request from
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
const reqId = uuid();
res.locals.log = log.child({ reqId });
next();
});
I am able to send messages to the bot successfully using the code snippet below:
let url = "https://api.cai.tools.sap/build/v1/dialog";
console.log(url)
let data = {
"message": {
"content": "Hello SAP Conversational AI",
"type": "text"
},
"conversation_id": conversationId
};
axios.post(url, data).then(function (response) {
console.log(`Status: ${response.data}`);
}).catch(function (error){
let errorCode = error.response.status;
if(errorCode === 401) {
getAccessToken();
initChat(conversationId, socketid);
}
return errorCode;
});
However when i try to update an existing conversation the error in the attached file gets generated. i have tried to trace the error to the addReply and Reply functions in /src/apis/resources/message.js but still unable to figure out what causes it.
Any help or suggestions will be highly appreciated. Thanks
Hi everyone,
I would appreciate any suggestions to help resolve the issue i am currently experiencing (Please see generated error in attached file). Everything seemed to be working fine till a few weeks ago. I use the sdk to receive and send messages to a SAP chatbot as shown in the code below. I keep getting an unauthorised error even after trying with both the designtime and runtime oauth credentials.
With the token generated as below:
I am able to send messages to the bot successfully using the code snippet below:
However when i try to update an existing conversation the error in the attached file gets generated. i have tried to trace the error to the addReply and Reply functions in /src/apis/resources/message.js but still unable to figure out what causes it.
Any help or suggestions will be highly appreciated. Thanks
error.txt
The text was updated successfully, but these errors were encountered: