Quick overview
This workflow receives a webhook request, fetches a doctor stamp/pad image from a separate file-management workflow, uses AWS Bedrock (Claude) vision OCR to extract structured doctor and facility details, and publishes the base64-encoded result to an AWS SNS topic, with matching SNS-based error notifications.
How it works
- Receives a POST request via a webhook and immediately returns a JSON acknowledgement containing the execution and workflow IDs.
- Calls a separate n8n workflow to fetch the source document image from file management based on the webhook payload.
- Resizes the image to a maximum of 800×800 pixels to standardize input and reduce payload size.
- Sends the image to an AWS Bedrock Claude vision chat model through an AI Agent that is instructed to strictly extract only clearly visible doctor and facility details and output valid JSON.
- Builds a success response that includes the extracted JSON plus the incoming executionRequestId and queryId.
- Base64-encodes the response payload and publishes it to an AWS SNS topic for downstream processing.
- If any execution error occurs, builds a standardized failure response, base64-encodes it, and publishes the error message to the same AWS SNS topic.
Setup
- Configure the Webhook endpoint and ensure the calling system sends the required request body fields (including executionRequestId and queryId) and an image reference that your file-management workflow can resolve.
- Set up and select AWS credentials for AWS Bedrock, and ensure access to the specified Claude inference profile/model.
- Set up AWS credentials for Amazon SNS and update the SNS topic ARN used for publishing success and error messages.
- Update the referenced “file import” (Execute Workflow) workflow to correctly fetch and return the image binary data expected by the image resize and AI steps.