Event Type: message.failed
This webhook is triggered when a message fails to process in the Kroll terminal after all retry attempts have been exhausted. It provides detailed information about the failure, including the original request data for potential replay.
POST {your-webhook-url}/failed-messageapplication/jsonContent-Typeapplication/jsonX-AutoRx-Eventmessage.failedX-AutoRx-SignatureHMAC-SHA256 signature{
"eventType": "message.failed",
"timestamp": "2023-12-21T10:30:56.789Z",
"data": {
"messageId": "msg-abc123",
"originalRequestId": "patient-1703123456789",
"pharmacyId": "123",
"operation": "create_patient",
"failureReason": "Connection timeout to pharmacy system",
"retryCount": 3,
"maxRetries": 3
}
}// Node.js webhook verification example
const crypto = require('crypto');
app.post('/webhooks/failed-message', (req, res) => {
const signature = req.get('X-AutoRx-Signature');
const payload = req.body;
const secret = process.env.AUTORX_WEBHOOK_SECRET;
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(payload, 'utf8')
.digest('hex');
if (signature !== 'sha256=' + expectedSignature) {
return res.status(401).send('Invalid signature');
}
const event = JSON.parse(payload);
if (event.eventType === 'message.failed') {
console.log('Message failed:', event.data.messageId);
}
res.status(200).send('OK');
});