Trying to parse the conversation object from a Genesys Cloud WEM webhook in an AWS Lambda function using Node.js 18.
Here is the handler:
exports.handler = async (event) => {
console.log(event.body);
const payload = JSON.parse(event.body);
console.log(payload.conversation.id);
};
Getting TypeError: Cannot read properties of undefined (reading 'id'). The logs show event.body is a string but payload seems empty or malformed. Why is payload.conversation undefined?