Deployed a Node.js Lambda to handle routing.queue.member.statusChange webhooks. The handler logs the raw event.body, but the events array is always undefined even though the payload contains the correct id and type fields. Here’s the snippet:
exports.handler = async (event) => { console.log(JSON.parse(event.body).events); };
Genesys Cloud reports 200 OK on the delivery status page. Is the structure different for this specific event type?
Check the event type. routing.queue.member.statusChange sends a single object, not an array. The events key only exists for batch endpoints like /api/v2/analytics/details/queries. You’re parsing the body correctly, but looking for the wrong structure. Try accessing the root properties directly.
exports.handler = async (event) => {
const payload = JSON.parse(event.body);
// Single event structure
console.log(payload.id);
console.log(payload.data.memberState);
};
If you’re hitting a batch endpoint by mistake, then events would be defined, but for standard webhooks, the data is at the top level. Also, make sure your webhook subscription is actually set to the specific queue ID and not a wildcard that might be sending different payload shapes. The docs are clear on this, but it’s easy to miss.