amazon-connect / voicemail-for-amazon-connect

The Voicemail for Amazon Connect solution helps call center administrators and managers automate a voicemail solution using Amazon Connect. A customer can call in, enter the extension number of the agent they want to speak with, and leave a voicemail for that specific agent. The solution generates voicemail recordings and transcripts that are delivered to agents using their preferred communication setting: SMS and/or email.
https://aws.amazon.com/solutions/implementations/voicemail-for-amazon-connect/
Apache License 2.0
65 stars 78 forks source link

Voicemail email time zone #78

Open maekiteasy opened 2 years ago

maekiteasy commented 2 years ago

I did see issue #11 mentioned the same thing, but wasn't sure if anyone would see my reply since it has been closed.

This is also an issue for our environment. It would be great if there was an easier way to change the time zone other than changing the code. Maybe there could be an environment variable in the Lambda function that could be easily changed to the desired value like "America/New_York" or "America/Denver"

maekiteasy commented 2 years ago

With some direction from AWS support, I was able to modify the code. Here was my solution. Download the Lambda code package for the following two functions:

TranscriptionEventsLambdaFunction ContactVoicemailStreamLambdaFunction

Change the code in the following two javascript files for each package: transcription.js voicemail.js

sendMail(e, t, n, r) {
        return new Promise((s, i) => {
                    let o = `<p>${(new Date(1e3*e.timestamp)).toLocaleString('en-US', { timeZone: 'America/Denver' })}</p>`;
                    if (o += `<p>New voicemail from ${e.contactPhoneNumber}.</p>`, r.transcription && (o += `<b>Voicemail Transcript:</b><p>${r.transcription.transcripts[0].transcript}</p>`), o += "<b>Voicemail:</b>", r.preSignedUrl) {
                        o += `<p>Voicemail Expiration Date: ${(new Date(1e3*Math.floor(Date.now()/1e3+r.preSignedUrl.expires))).toLocaleString('en-US', { timeZone: 'America/Denver' })}</p>`, o += `<p><a href="${r.preSignedUrl.url}">Click Here</a> to listen to the voicemail</p>`
                    }

Then re-zip the packages and upload them into the functions. I had trouble zipping in Windows due to file/path length, so I did it in Linux.

Next time I'll have to try cloning the dev branch and building my own. It would be great if there was an Environment Variable that could be easily edited in the Lambda function overview for this value.

henry-white89 commented 1 year ago

I would also like to request this feature be implemented. An environment variable for timezone would be most appreciated.