Problem
WhatsApp inbound messages are triggering the webhook, but the Express middleware keeps choking on the payload structure. GC sits at 2025-01.1000.0. The JWT validation passes fine, signature checks out, but the actual messaging.message.created object dropped the old media array. Media files are suddenly nested under attachments with a completely different shape. Web chat payloads still look normal. Only WhatsApp is doing this. Server’s doing jack all but logging 200s while the queue backs up. Dropped three hundred messages into the dead letter queue before the circuit breaker finally tripped.
app.post('/webhooks/gc-messaging', (req, res) => {
const payload = req.body;
if (payload.event === 'messaging.message.created') {
const mediaUrl = payload.media?.[0]?.url; // Throws here
processInboundMessage(payload, mediaUrl);
}
res.status(200).send('OK');
});
TypeError: Cannot read properties of undefined (reading 'url')
at Router.handle (/app/node_modules/express/lib/router/index.js:184:18)
Payload dump shows media is completely absent. attachments has an array of objects with type: 'image/jpeg' and contentUrl. The externalChannelId field is also null on the second retry attempt, which breaks the idempotency check in the downstream Lambda. Rate limits aren’t the issue. The webhook endpoint logs show 200 OK on the first hit, then 401 on the retry because the JWT exp claim seems to be generated with a weird offset. Clock skew on the EC2 instance sits at forty-two milliseconds.
Question
Schema version headers are missing from the X-Genesys metadata. The docs don’t show the new nesting pattern. Patched the middleware to check payload.attachments first as a temporary workaround. Still getting sporadic 401 rejections on retries despite nodelay being set. JWT clock tolerance is already bumped to 60 seconds.