Hey folks,
Trying to process Genesys Cloud webhooks in a Node.js Lambda function, but the payload structure is throwing me off. I’m expecting a clean JSON object with conversation details, but I’m getting nested objects that don’t match the docs exactly.
Here’s the relevant part of my handler:
exports.handler = async (event) => {
const body = JSON.parse(event.body);
console.log('Received:', body);
// This fails because body.conversationId is undefined
const convId = body.conversationId;
return {
statusCode: 200,
body: JSON.stringify({ message: 'Processed' })
};
};
The console log shows body as an object with type and data, but no conversationId at the root. I’ve checked the webhook configuration in Genesys Cloud, and it’s set to send JSON.
Am I missing a step in parsing the event, or is the payload format different than expected? I’ve tried accessing body.data.conversationId, but that’s also undefined.
Any ideas on what the actual structure looks like? I’m stuck on this for hours now.