When we add enable Call Recording Behavior in contact flow the call recording files are pushed & stored in S3 with contactId_timestamp.wav
format file.
We can get the contactId using Amazon connect stream API getContactId()
event. I want to get the recordings of every call after call completed so to get the recordings from S3 i need to pass the key as filename in getObject Api.
So, i am trying to automate this in my code as after every single call it will fetch/pull the call recording and add it in my call activity, the same procedural we are experiencing in Search Contact Flow
as after every call we get a audio file.
How to get the timestamp to make and access the call recording files by names?
So far i what i have done is:
-Used getObject Api to get/downloading the recording by filename.
require("dotenv").config();
const expres = require("express");
const app = expres();
app.listen(3001);
const aws = require("aws-sdk");
const multer = require("multer");
const multerS3 = require("multer-s3");
aws.config.update({
secretAccessKey: process.env.ACCESS_SECRET,
accessKeyId: process.env.ACCESS_KEY,
region: process.env.REGION
})
const BUCKET = process.env.BUCKET
const s3 = new aws.S3(secretAccessKey = process.env.ACCESS_SECRET, accessKeyId = process.env.ACCESS_KEY);
app.get("/download/filename", async(req, res)=>{
const filename = req.params.filename
let x = await s3.getObject({Bucket:BUCKET, Key:filename}).promise();
res.send(x.Body);
})
Thanks @bbolek, I am using Amazon Connect Streams, can we get disconnecttimestamp somehow like contact.getQueueTimestamp() ? I wanted to make the filename by myself by adding contactId + disconnecttimestamp.