icy-painting-67927
04/25/2024, 10:42 AMasync function submitDataToAPI() {
const feedbackData = {
// "user_name": workflow.username,
// "user_phone": workflow.userPhone,
"user_name": "ram",
"user_phone": "91234567890",
"start_time": workflow.usertimestart,
"end_time": workflow.usertimeend,
"messages": conversation.SummaryAgent.transcript,
"feedbackgiven": workflow.FeedbackGiven
}
console.log(JSON.stringify(feedbackData))
const options = {
uri: 'http://3426-49-206-133-52.ngrok-free.app/api/submit_feedback',
method: 'POST',
headers:{
'Content-Type': 'application/json',
'Content-Length': '99999'
},
data: feedbackData
//data: JSON.stringify(feedbackData)
}
try{
console.log('before axios')
await axios(options)
console.log('after axios')
console.log('Feedback submitted successfully')
} catch(error){
console.error('Error submitting Feedback: ', error)
}
}
submitDataToAPI();
It works fine when I use it in Postman and records are created in db, but when I try the same in botpress, I get errors in logs.
Is there anything wrong with how I call the API in botpress?
https://cdn.discordapp.com/attachments/1233005134120747130/1233005134552891432/image.png?ex=6634bf84&is=66336e04&hm=2e010de982e7ff4d66fb0c36db5fbef91cc4555fea85251d444b68fb86dcabe6&
https://cdn.discordapp.com/attachments/1233005134120747130/1233005134938898452/image.png?ex=6634bf84&is=66336e04&hm=44c15908f0dbd510e61d645213494f33e382d933564d0b3d253041edc4b7d34c&
https://cdn.discordapp.com/attachments/1233005134120747130/1233005135332900896/image.png?ex=6634bf84&is=66336e04&hm=709e1333cc3a851a2cd4c67e71f96473115def5a62ace41343779756b4fed1a3&fresh-fireman-491
04/25/2024, 10:59 AMicy-painting-67927
04/25/2024, 11:02 AMfresh-fireman-491
04/25/2024, 11:10 AMicy-painting-67927
04/26/2024, 3:06 AMfresh-fireman-491
04/26/2024, 4:25 AMicy-painting-67927
04/26/2024, 4:43 AMfresh-fireman-491
04/26/2024, 4:50 AMfresh-fireman-491
04/26/2024, 4:50 AMfresh-fireman-491
04/26/2024, 4:51 AMfresh-fireman-491
04/26/2024, 4:51 AMfresh-fireman-491
04/26/2024, 4:51 AMfresh-fireman-491
04/26/2024, 4:51 AMfresh-fireman-491
04/26/2024, 4:54 AMicy-painting-67927
04/26/2024, 5:27 AMfresh-fireman-491
04/26/2024, 5:53 AMicy-painting-67927
04/26/2024, 5:56 AMfresh-fireman-491
04/26/2024, 8:32 AMicy-painting-67927
04/26/2024, 9:09 AM