Opening Problem Statement
Meet Lisa, a busy recruiter who receives dozens of resumes every day through various messaging platforms like Telegram. Each resume is a PDF file full of valuable candidate information — personal data, education history, employment experiences, projects, volunteering, and technology skills. Manually extracting this data, converting it into a readable format, and compiling it into a neat document for hiring managers is tedious, time-consuming, and prone to mistakes.
Lisa often spends over two hours every day copying details from resumes, formatting them into a consistent structure, and preparing them for review. Not only does this slow her down, but it also leads to occasional errors and data loss, frustrating candidates and managers alike. Lisa wishes she had an effortless way to automatically parse resumes and transform them into professional reviewed PDFs ready to be shared.
What This Automation Does
This n8n workflow streamlines Lisa’s entire resume processing task by automating resume data extraction and downstream formatting, leveraging Telegram, GPT-4 Turbo from OpenAI, and a PDF generation service with Gotenberg. When triggered by a Telegram resume upload, this workflow:
- Receives the resume PDF file sent to a Telegram bot.
- Automatically downloads and extracts the resume’s text content.
- Uses OpenAI’s GPT-4 Turbo to parse the text into a clean, structured JSON format with specific fields like personal info, employment history, education, projects, volunteering, and skills.
- Converts parsed JSON data sections into beautifully formatted HTML snippets for each resume section.
- Merges all these formatted HTML parts into one comprehensive HTML document.
- Transforms the HTML into a PDF file using the Gotenberg conversion tool.
- Sends the resulting professional PDF resume back to the user via Telegram, identified by chat ID.
By automating what took Lisa hours, she now processes resumes in under a minute with flawless accuracy and presentation.
Prerequisites ⚙️
- Telegram account and creation of Telegram Bot with API access (Telegram Trigger, Telegram nodes).
- OpenAI account with GPT-4 Turbo access and API key (OpenAI Chat Model nodes).
- n8n account for workflow automation.
- Running Gotenberg instance for HTML to PDF conversion (or alternative PDF API service like PDFMonkey or ApiTemplate).
- Basic knowledge of setting up n8n credentials and installing nodes.
Step-by-Step Guide
Step 1: Set up your Telegram Trigger
In n8n, add the Telegram Trigger node located under the Telegram nodes category. Configure it to listen for new message updates. Connect it to your Telegram Bot credential. This node waits for any user messages sent to your bot — especially document uploads like resumes.
Visual tip: You’ll see a webhook URL generated to connect Telegram with n8n.
After this step, your workflow starts when a user uploads a resume file via Telegram.
Common mistake: Forgetting to set the Telegram Bot API credentials or chatbot webhook registration in Telegram.
Step 2: Authorize user validation
Next, the workflow includes an If node titled “Auth” that restricts access by verifying chat.id from incoming messages. Set the condition to your Telegram chat ID to prevent unauthorized users from triggering the workflow.
If the ID does not match, the flow sends execution to a No Operation node that silently ends processing.
Common mistake: Using an incorrect chat ID or leaving the condition empty will block legitimate users.
Step 3: Filter out start command messages
Use another If node “Check if start message” to ignore the initial /start command users send to the bot. This ensures the workflow processes only actual resume file uploads.
Messages not equal to /start proceed in flow, others go to a No Operation node.
Step 4: Download the resume PDF file
Add a Telegram node with the “Get file” operation configured to fetch the document file using the Telegram file_id extracted from the incoming message.
This step downloads the PDF of the resume to prepare it for text extraction.
Common mistake: Not checking the message contains document file info before extracting file_id.
Step 5: Extract text from the PDF
Insert the Extract Text from PDF node, which pulls readable text from the downloaded PDF file. This raw text becomes the input for AI parsing.
Visual confirmation: You will see extracted resume text in the node’s output data.
Step 6: Parse resume text using OpenAI GPT-4 Turbo
Use the OpenAI Chat Model node configured with the “gpt-4-turbo-preview” model and options for zero temperature and JSON response format. The node prompt instructs GPT to extract resume details strictly and output a unified JSON object containing personal info, employment, education, projects, volunteering, and programming languages.
This parsing step leverages advanced AI to turn unstructured text into consistent structured data.
Tip: Adjust the JSON schema in the accompanying structured output parser node if your resume has different fields or additional sections.
Step 7: Auto-fix inconsistent AI outputs
Add an Auto-fixing Output Parser node next in the chain connected to the OpenAI node to validate and correct any minor AI formatting errors ensuring clean JSON output.
Step 8: Set parsed fields and convert sections to HTML
Once JSON is parsed, use multiple Code nodes numbered respectively for employment history, education, projects, and volunteering. Each contains JavaScript code that iterates over arrays, formats each item into well-structured HTML strings with bold labels and line breaks for readability.
Example snippet for education HTML conversion:
function convertToHTML(list) {
let html = '';
list.forEach((education, index) => {
if (index > 0) html += '
';
html += `Institution: ${education.institution}
Start year: ${education.start_year}
Degree: ${education.degree}`;
});
return html;
}
const payload = $input.item.json.education;
const htmlOutput = convertToHTML(payload);
return { htmlOutput };Step 9: Format simple personal info and technologies
Use Set nodes for formatting simple string values such as personal info and technology skills into HTML blocks using template variables with line breaks and bold headings.
Step 10: Merge individual HTML sections
Merge the sections logically: education with employment history, projects with volunteering, then merge personal info with technologies, and lastly combine all larger merged parts into a final HTML document.
This layered merging ensures the full resume content is joined in order.
Step 11: Set final HTML output as a single string
Use one more Set node to assemble all merged sections into one big HTML string under the key “output”, ready for file generation.
Step 12: Encode HTML content to base64
Add a Code node to convert the raw large HTML string into a base64 encoded string. This is necessary for feeding the data into the file conversion node.
Step 13: Convert the base64 output to an HTML binary file
Use Convert To File node to convert the base64 string back into a downloadable “index.html” file with MIME type text/html. This produces a proper binary file for PDF conversion.
Step 14: Generate PDF file from HTML using Gotenberg
Pass the HTML binary file to an HTTP Request node configured to call the Gotenberg API’s Chromium converter POST endpoint. This returns the generated PDF as a binary file in response.
Ensure Gotenberg container is running and accessible at the configured address.
Step 15: Send PDF back to user over Telegram
Finally, upload the generated PDF file document back to the Telegram user who started the interaction, using the Telegram node’s “sendDocument” operation. The file is named dynamically based on the user’s personal name.
Customizations ✏️
- Adjust OpenAI JSON schema: Modify the
Structured Output Parsernode’s JSON schema to include additional resume fields or tweak field types to match your resume format. - Change PDF generation service: Replace the Gotenberg HTTP Request node with any other HTML to PDF API like PDFMonkey by modifying the request URL and parameters accordingly.
- Update Telegram Auth conditions: Add multiple authorized Telegram chat IDs or integrate a user database to customize who can use your resume parser bot.
- Modify HTML formatting: Customize JavaScript in Code nodes to change the HTML layout, add CSS styles inline for improved presentation inside the generated PDFs.
Troubleshooting 🔧
Problem: “Invalid API key or authentication error in Telegram node.”
Cause: Incorrect Telegram Bot token or expired credentials.
Solution: Go to Telegram trigger and Telegram nodes, re-authenticate by providing the correct Bot token in the n8n credentials section.
Problem: “Empty text extracted from PDF or parsing errors in OpenAI nodes.”
Cause: PDF file might be scanned image-based or encrypted, leading to no text extraction.
Solution: Verify the PDF content – if scanned, use OCR-enabled extract nodes or preprocess the document. Also, check the PDF extraction node is correctly connected and receives binary data.
Problem: “Unexpected JSON format or parsing failures in AI output parser nodes.”
Cause: AI model output not matching configured JSON schema.
Solution: Review the OpenAI prompt and schema in Structured Output Parser. Enable Auto-fixing Output Parser step to self-correct minor formatting issues.
Pre-Production Checklist ✅
- Ensure Telegram Bot is properly set with required permissions and webhook is active.
- Test PDF upload with a sample resume and observe if text extraction node returns text successfully.
- Verify OpenAI credentials and model configuration for correct JSON output parsing.
- Validate HTML output generation by previewing outputs from Code nodes for each resume section.
- Confirm Gotenberg endpoint is reachable and correctly converts HTML to PDF.
- Run entire workflow with test chat ID to ensure PDF is sent back correctly via Telegram.
- Backup all workflow credentials and export workflow JSON before production deployment.
Deployment Guide
Activate your workflow by saving and toggling the n8n workflow to “On.” The Telegram Trigger node listens indefinitely for new messages. Monitor executions in n8n’s dashboard to track successes or errors.
Use n8n’s built-in logging and error handling for debugging. For scale, consider running Gotenberg in a robust server environment and securing your Telegram Bot access.
FAQs
Q: Can I swap Telegram for email input?
A: Yes, replacing the Telegram Trigger with an email trigger like Gmail node is possible but requires adjusting file retrieval nodes accordingly.
Q: Does this workflow use many OpenAI API credits?
A: It uses one GPT-4 Turbo call per resume processed, typically a few hundred tokens per resume, balancing quality with cost.
Q: Is user data secure in this workflow?
A: Data flows within your controlled n8n environment. Ensure secure API keys, encrypted nodes, and private bot setup for privacy.
Q: Can this workflow process large volumes of resumes?
A: For moderate daily resume volumes, yes. For scale, deploy multiple n8n workers and robust Gotenberg instances to handle concurrent PDF generations.
Conclusion
By following this guide, you’ve built a powerful resume parsing automation that saves Lisa and recruiters like her hours of manual effort every day. This workflow converts unstructured PDF resumes sent through Telegram into clean, well-formatted PDF documents structured for easy review.
You have leveraged cutting-edge AI with GPT-4 Turbo for precise data extraction and paired it with reliable PDF generation via Gotenberg. This automation enhances productivity, ensures accuracy, and elevates the recruitment process with minimal manual intervention.
Next, consider extending this automation by integrating a candidate database, adding email notifications, or automating interview scheduling to create a full hiring pipeline.
Feel confident and empowered as you put this automation into practice — future resume processing will never be the same.