Trying to wire up a real-time event stream from Genesys Cloud to an AWS EventBridge bus. The Genesys side is configured with a webhook pointing to my EventBridge PutEvents API endpoint via a Lambda proxy.
The Lambda receives the payload, parses it, and pushes to the bus. But Genesys is returning a 422 Unprocessable Entity on the initial POST.
Here’s the raw request body Genesys sends:
{
"eventType": "routing.queue.conversation",
"data": {
"conversationId": "abc-123",
"timestamp": "2023-10-27T14:00:00Z"
}
}
My Lambda handler looks like this:
def lambda_handler(event, context):
client = boto3.client('events')
client.put_events(
Entries=[
{
'Source': 'genesys.cloud',
'DetailType': event['eventType'],
'Detail': json.dumps(event['data'])
}
]
)
return {
'statusCode': 200,
'body': json.dumps('OK')
}
The CloudWatch logs show the Lambda executing successfully with a 200 response. Yet Genesys retries and logs a 422. The docs say 422 means the payload format is wrong, but I’m just echoing the event back. Is there a specific header or content-type requirement for the EventBridge proxy that I’m missing? Or is the Detail field size limit kicking in?