Last active
September 3, 2021 05:04
-
-
Save shinsaka/ae79fc9f40d5d2c55e9a92d22c7567db to your computer and use it in GitHub Desktop.
Logging Sample for Amazon Connect Agent Event Stream by Lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = async (event) => { | |
event.Records.map(({kinesis}) => { | |
const payload = Buffer.from(kinesis.data, 'base64').toString(); | |
outputlog(JSON.parse(payload)); | |
}); | |
return {statusCode: 200}; | |
}; | |
function outputlog({EventType, EventTimestamp, CurrentAgentSnapshot}) { | |
if (EventType === 'HEART_BEAT') return; | |
console.log(`${EventTimestamp}, ${EventType}, ${JSON.stringify(CurrentAgentSnapshot.Contacts)}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment