trying to wire up a Genesys Cloud webhook directly to an AWS Lambda function for real-time conversation logging. the setup is straightforward enough, but the payload structure is tripping up the initial parsing logic in my node handler.
the webhook fires on conversation:updated. i’m sending the raw body to the lambda, but when i try to access the participants array, i keep getting undefined. here’s the minimal repro:
exports.handler = async (event) => {
try {
const payload = JSON.parse(event.body);
console.log('received event type:', payload.event_type);
const participants = payload.conversation.participants;
console.log('participants count:', participants.length);
return {
statusCode: 200,
body: JSON.stringify({ processed: true })
};
} catch (error) {
console.error('parse error:', error.message);
return {
statusCode: 400,
body: error.message
};
}
};
the log shows received event type: conversation:updated correctly. but the next line throws TypeError: Cannot read properties of undefined (reading 'length').
i’ve checked the raw event.body in cloudwatch and the json looks valid. the conversation object is definitely there. is there a specific nesting level i’m missing for the participants in the v2 webhook schema? or is this an issue with how api gateway is wrapping the body?
i’m on the central pacific time zone, so debug sessions are short.