Commit 2442d6cc by Dhamodharan S

fix

parent 0374ce84
Pipeline #35284 passed with stages
in 2 minutes 58 seconds
......@@ -26,7 +26,14 @@ async function sentFiles(req, res) {
let mimetype = req.file.mimetype;
let base_path = `local/whatsapp_api/files/${req.file.filename}.${ mimetype.split("/")[1] }`;
const fileContent = fs.readFileSync(req.file.path);
let result = await S3Upload.s3Upload(fileContent, base_path, req.file.path);
let result;
console.log(req.body.filelink);
if (req.body.filelink) {
result = { path: req.body.filelink };
} else {
result = await S3Upload.s3Upload(fileContent, base_path, req.file.path);
}
console.log(result)
img.includes(mimetype) ? (type = 'image_link') : (doc.includes(mimetype) ? (type = 'file') :
(audio.includes(mimetype) ? (type = 'audio_link') : (video.includes(mimetype) ? (type = 'video_link') : "")));
......
......@@ -6,7 +6,9 @@ async function saveResponse(req, res) {
let media_id = "";
let message_id = "";
console.log(response);
if (response.data && response.data.connectionname && response.data.receiveraddress) {
if (response.data) {
let receiveraddress = response.data.receiveraddress ? response.data.receiveraddress : "";
let connectionname = response.data.connectionname ? response.data.connectionname : "";
let orgevnt = "";
(response.data.parts[0] && response.data.parts[0].originalEvent) ? (orgevnt = JSON.parse(response.data.parts[0].originalEvent)) : "";
console.log(orgevnt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment