Most businesses lose hours every week doing the same tasks over and over. Sending follow-up emails. Sorting support tickets. Updating spreadsheets. These are not high-value tasks. They are just repetitive ones.
The good news is that you can automate most of them today without writing a full application. You just need two tools: n8n and OpenAI.
This guide walks you through exactly how to do that, step by step, with real code samples you can use right away.
What is n8n?
n8n is an open-source workflow automation tool. Think of it like Zapier but with far more flexibility. You can host it yourself, connect it to any API, write custom code inside workflows, and build logic that actually fits how your business works.
It uses a visual canvas where you connect "nodes" together. Each node does one job. Trigger a workflow. Call an API. Send an email. Transform data. That is it.
What is OpenAI Doing Here?
OpenAI gives your workflows a brain. Instead of just moving data from one place to another, you can now understand it, summarize it, classify it, and respond to it.
A support email comes in. OpenAI reads it and tells n8n whether it is a billing question or a technical issue. n8n then routes it to the right team. No human needed for that step.
That is the core idea.
Before You Start
You need three things set up before building any workflow.
1. A running n8n instance
The fastest way to get started locally:
npx n8n
Or with Docker:
docker run -it --rm \ --name n8n \ -p 5678:5678 \ -v ~/.n8n:/home/node/.n8n \ n8nio/n8n
Open your browser at http://localhost:5678 and you are in.
2. An OpenAI API key
Go to platform.openai.com, create an account, and generate an API key. Keep it somewhere safe.
3. n8n credentials set up
In n8n, go to Settings > Credentials > New. Search for "OpenAI" and paste your API key. Save it. Every OpenAI node in your workflows will use this.
Workflow 1: Auto-Classify Support Emails
The problem: Your support inbox gets 200 emails a day. Someone has to read each one and move it to the right folder or assign it to the right person.
The fix: n8n picks up each email. OpenAI reads it and returns a category. n8n routes it automatically.
Step 1: Set Up the Email Trigger
Add an Email Trigger (IMAP) node. Connect it to your support inbox.
{
"node": "Email Trigger (IMAP)",
"config": {
"host": "imap.yourmail.com",
"port": 993,
"user": "support@yourcompany.com",
"password": "{{your_password}}",
"mailbox": "INBOX",
"action": "getMessage"
}
}
This node fires every time a new email arrives.
Step 2: Send the Email to OpenAI for Classification
Add an HTTP Request node after the email trigger. Point it to the OpenAI Chat Completions endpoint.
{
"method": "POST",
"url": "https://api.openai.com/v1/chat/completions",
"headers": {
"Authorization": "Bearer {{your_openai_key}}",
"Content-Type": "application/json"
},
"body": {
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You are a support ticket classifier. Read the email and return only one of these labels: billing, technical, general, urgent. Return the label only. No explanation."
},
{
"role": "user",
"content": "{{$json.text}}"
}
]
}
}
The response will be something like billing or technical. Clean. No fluff.
Step 3: Route With a Switch Node
Add a Switch node. Set conditions based on the OpenAI response.
If value equals "billing" → Route to Billing Team Slack channel If value equals "technical" → Route to Tech Team Slack channel If value equals "urgent" → Send SMS via Twilio If value equals "general" → Add to Trello board
Each branch calls the right integration node. Done.
Workflow 2: Auto-Generate Weekly Reports
The problem: Every Monday, someone pulls numbers from different tools and writes a summary report. It takes two hours. The report usually says the same things just with different numbers.
The fix: n8n collects the data. OpenAI writes the report. It lands in your inbox before you even open your laptop.
Step 1: Schedule the Trigger
Add a Schedule Trigger node.
{
"node": "Schedule Trigger",
"config": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 7 * * 1"
}
]
}
}
}
This fires every Monday at 7am.
Step 2: Pull Data From Your Tools
Add HTTP Request nodes for each data source. Here is an example pulling from a Google Sheets document using the Sheets API:
{
"method": "GET",
"url": "https://sheets.googleapis.com/v4/spreadsheets/{{SHEET_ID}}/values/Sheet1!A1:Z100",
"headers": {
"Authorization": "Bearer {{google_token}}"
}
}
Do the same for any other source you use. HubSpot. Stripe. PostgreSQL. Whatever you have. Each node adds its data to the workflow.
Step 3: Combine the Data With a Code Node
Add a Code node to merge everything into one clean object.
const sales = $('Google Sheets').first().json;
const tickets = $('HubSpot').first().json;
const summary = {
week: new Date().toISOString().split('T')[0],
total_sales: sales.values.length,
open_tickets: tickets.total,
closed_tickets: tickets.closed,
revenue: sales.values.reduce((sum, row) => sum + Number(row[3] || 0), 0)
};
return [{ json: summary }];
Step 4: Ask OpenAI to Write the Report
Add an HTTP Request node to call OpenAI.
{
"method": "POST",
"url": "https://api.openai.com/v1/chat/completions",
"body": {
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You write concise weekly business reports. Use plain English. Keep it under 300 words. Format it with clear sections."
},
{
"role": "user",
"content": "Write a weekly report based on this data: {{JSON.stringify($json)}}"
}
]
}
}
Step 5: Send the Report
Add a Gmail or Outlook node. Use the OpenAI response as the email body. Send it to your team.
{
"to": "team@yourcompany.com",
"subject": "Weekly Business Report — {{$now.format('MMMM D, YYYY')}}",
"body": "{{$('OpenAI').first().json.choices[0].message.content}}"
}
Workflow 3: AI-Powered Lead Qualification
The problem: Your sales team gets 50 new form submissions a week. Half of them are not a good fit. Someone still has to read each one to figure that out.
The fix: OpenAI scores each lead as soon as the form is submitted. Only qualified leads hit the CRM.
Step 1: Catch the Form Submission
Add a Webhook node. Use the webhook URL in your form tool (Typeform, Tally, custom form).
POST https://your-n8n-instance.com/webhook/lead-intake
Step 2: Score the Lead With OpenAI
{
"method": "POST",
"url": "https://api.openai.com/v1/chat/completions",
"body": {
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You are a B2B sales qualification assistant. Score this lead from 1 to 10 based on company size, role, and use case described. Return a JSON object with score (number) and reason (one sentence). Return only valid JSON."
},
{
"role": "user",
"content": "Name: {{$json.name}}\nCompany: {{$json.company}}\nRole: {{$json.role}}\nTeam size: {{$json.team_size}}\nUse case: {{$json.use_case}}"
}
]
}
}
Step 3: Parse the Score and Route
Add a Code node to parse the JSON response.
const raw = $('OpenAI').first().json.choices[0].message.content;
const parsed = JSON.parse(raw);
return [{
json: {
...($('Webhook').first().json),
ai_score: parsed.score,
ai_reason: parsed.reason,
qualified: parsed.score >= 7
}
}];
Step 4: Add to CRM if Qualified
Add an IF node. If qualified is true, send to HubSpot or Salesforce or Odoo. If false, send a polite "not a fit right now" email automatically.
Workflow 4: Document Summarization Pipeline
The problem: Your team uploads contracts, reports, or research documents. People need a summary before deciding to read the full thing.
The fix: Every uploaded file gets a summary generated automatically and saved alongside it.
Step 1: Watch for New Files
Use a Google Drive Trigger or Dropbox Trigger node.
{
"node": "Google Drive Trigger",
"config": {
"triggerOn": "fileCreated",
"folderId": "{{your_folder_id}}"
}
}
Step 2: Download and Extract Text
Add an HTTP Request node to download the file. Then add a Code node to extract the text.
// For plain text files
const content = Buffer.from($binary.data, 'base64').toString('utf8');
return [{ json: { content: content.slice(0, 8000) } }];
For PDFs, use a service like PDF.co or run a simple Python script via the Execute Command node.
Step 3: Summarize With OpenAI
{
"method": "POST",
"url": "https://api.openai.com/v1/chat/completions",
"body": {
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "Summarize the document in 5 bullet points. Keep each point under 20 words. Be specific."
},
{
"role": "user",
"content": "{{$json.content}}"
}
]
}
}
Step 4: Save the Summary
Save the output back to Google Drive as a .txt file next to the original. Or post it to a Slack channel so everyone sees it instantly.
Tips for Building Reliable Workflows
Always handle errors. Add an Error Trigger node in your workflow settings. Send error alerts to a Slack channel so you know when something breaks.
Log everything. Add a Google Sheets or Airtable node at the end of your workflows to save a record of each run. You will thank yourself later.
Use environment variables. Store API keys as n8n credentials or environment variables. Never hardcode them in nodes.
Test with small data first. Before you let a workflow run on your real data, test it with a sample payload. n8n has a built-in test mode for this.
Keep prompts tight. Vague prompts give vague results. Tell OpenAI exactly what format you want back. If you need JSON, say so. If you need one word, say so.
How Bithost Can Help You Build This
Setting up n8n and OpenAI workflows takes time. Hosting them reliably takes infrastructure. That is where Bithost comes in.
Here is what Bithost brings to the table:
Managed n8n Hosting — Bithost hosts your n8n instance on a stable server so you do not have to worry about uptime, updates, or crashes interrupting your automations.
Workflow Design and Build — The Bithost team builds your automation workflows from scratch. You describe the process you want to automate and they turn it into a working n8n workflow connected to your existing tools.
OpenAI Integration Setup — Bithost handles the API setup, prompt engineering, and response handling so your AI steps actually return useful and consistent results.
Custom Integrations — If your business uses a tool that does not have a native n8n node, Bithost builds a custom HTTP integration for it. Your workflow connects to anything.
Monitoring and Maintenance — Workflows break when APIs change or data formats shift. Bithost monitors your workflows and fixes issues before they affect your operations.
Team Training — Once your workflows are live, Bithost trains your team on how to read them, adjust them, and add new ones without needing a developer every time.
Security and Compliance — For businesses handling sensitive data, Bithost sets up n8n with proper access controls, encrypted credentials, and audit logging.
Whether you are automating one process or rebuilding your entire operations layer, Bithost makes sure the foundation is solid and the workflows actually run.
Where to Go From Here
Start with one workflow. Pick the most annoying repeated task in your business. Something your team does manually every day that follows a predictable pattern.
Build it in n8n. Add OpenAI where a human normally has to read or decide something. Test it. Let it run for a week.
Then build the next one.
Most businesses that start here end up automating 60 to 70 percent of their routine operations within three months. Not because the technology is magic but because once you see it work, the next use case becomes obvious.
You already know what your repetitive tasks are. Now you have the tools to stop doing them manually.
Built with n8n and OpenAI. Hosted and supported by Bithost.