← Back to Blog

Building a Supplement Protocol Builder With n8n and OpenAI

A supplement protocol builder automates one of the most time-consuming parts of a functional medicine educator's workflow. Here is how to build one that stays compliant.

This article is for educational and informational purposes only. It does not constitute legal, medical, or professional advice. Consult qualified professionals for guidance specific to your situation.

The Time Cost of Protocol Building

For functional medicine educators, researching general nutrition topics for client education is one of the most time-consuming parts of the workflow. Gathering background reading, checking what the published literature says, and formatting it for review can take 30 to 60 minutes. Individualized supplement recommendations are a separate activity. Those require a licensed clinician who knows the client, has their full medication list, and is responsible for their care. If you are not that clinician, this workflow produces reading material, not a protocol.

An AI-assisted research tool does not supply clinical judgment, and it does not confer it on the person running the workflow. It accelerates reading and formatting. If the output is going to inform what a specific client actually takes, a licensed clinician who knows that client has to make that call.

This post covers the n8n workflow that automates the supplement protocol building process, with specific attention to the compliance framing that keeps it in educator territory.

The Workflow Architecture

The supplement protocol builder is Workflow 5 in the n8n roadmap. It runs inside the same n8n instance as the intake router, in a separate workflow tab.

The trigger is a form submission from the educator's dashboard (not from the client-facing app). The educator fills out a protocol request form with:

  • Client reference ID (not name, to keep the n8n layer non-PHI)
  • Health focus areas (dropdown: cardiovascular, metabolic, gut health, hormonal, immune, cognitive)
  • Known medication categories (dropdown: statins, antihypertensives, anticoagulants, none, other)
  • Dietary restrictions (dropdown: vegan, vegetarian, gluten-free, dairy-free, none)
  • Protocol goals (free text, 200 character limit)

The form sends a webhook to n8n. n8n sends the data to the OpenAI API with a carefully designed system prompt. The response is formatted and sent to the educator via Gmail.

The System Prompt Design

The system prompt for the protocol builder is the compliance-critical element. Here is the structure:

You are a functional medicine nutrition researcher assisting a PharmD educator in reviewing supplement research for educational purposes.

Based on the health focus areas, medication categories, and dietary restrictions provided, generate an educational research summary covering:

1. General nutrition topics associated with the named area of interest, described in terms of normal body structure and function rather than in terms of a disease or condition. Do not present any nutrient as addressing, improving, or managing a named disease state
2. For each topic, state what the NIH Office of Dietary Supplements or NCCIH says, name that source, and link to it. Where those sources describe the evidence as limited, mixed, or insufficient, say so in those words. Do not state a consensus you cannot point to
3. Common food sources for each nutrient
4. General considerations when these nutrients are used alongside the specified medication categories (educational, not clinical)
5. Suggested questions the educator might explore with the client's healthcare provider

Format the output as a structured educational summary, not a prescription or treatment plan.

Important constraints:
- Do not recommend specific doses
- Do not diagnose conditions
- Where a nutrient and medication interaction is documented by an authoritative source, name it plainly and cite the source, so it can be verified
- Do not present any interaction statement as a clinical decision. Route every one of them to the client's prescriber or pharmacist for review
- Frame all content as educational research summary
- Include this disclaimer at the end: "This summary is for educational reference only. It does not constitute medical advice, diagnosis, or a treatment plan. These statements have not been evaluated by the Food and Drug Administration. No supplement mentioned here is intended to diagnose, treat, cure, or prevent any disease. Individualized recommendations require a licensed clinician who knows you, has your full medication list, and is responsible for your care. Review every item here with that clinician and with your prescriber or pharmacist before changing anything you take."

The Medication Interaction Layer

The medication interaction section is the part that needs the most scrutiny, not the least. A language model will produce interaction statements that read as authoritative and are simply wrong. Every interaction the model surfaces has to be checked against a validated reference such as the NIH Office of Dietary Supplements fact sheets or a licensed interaction database before anyone acts on it. A PharmD's pharmacology training is what makes that verification possible. Without a pharmacist or prescriber verifying the output, this section is a liability rather than a feature. The system prompt is designed to surface educational information about nutrient-drug interactions that a non-pharmacist educator would not know to look for.

The interaction categories covered:

  • Statins and CoQ10, where NCCIH states the overall evidence does not support CoQ10 for statin-associated muscle pain. Include this as a commonly asked question with the evidence stated honestly, not as a recommendation
  • Warfarin and vitamin K intake consistency, and warfarin and ginkgo, which NCCIH states may increase bleeding risk. For omega-3s, ODS notes that most research shows 3 to 6 g/day does not significantly affect anticoagulant status, but that patients should have their INR monitored periodically. Any of these goes to the prescribing clinician, not into a summary
  • Potassium with ACE inhibitors, ARBs, or potassium-sparing diuretics. ODS documents that these reduce urinary potassium excretion and can cause hyperkalemia. This is a hard stop, not a consideration. Anyone on these drugs needs their prescriber to approve any potassium intake change
  • Loop and thiazide diuretics and magnesium status, where ODS documents urinary magnesium loss with chronic treatment. Note that ODS lists no magnesium interaction with antihypertensives as a class
  • CoQ10 and blood pressure, where NCCIH states CoQ10 probably does not have a meaningful effect
  • Levothyroxine and calcium carbonate, where the FDA-approved label advises avoiding levothyroxine within 4 hours of the supplement, and levothyroxine and iron, which is a documented absorption interaction. ODS documents no selenium interaction with thyroid medication, so do not include one
  • Metformin and B12 depletion

Calling something educational does not make it safe. Some of these are genuine hazards, and the potassium one in particular can be dangerous. The honest framing is this: the workflow surfaces topics that need a licensed clinician's attention, and it hands them to that clinician. It does not resolve them, and neither does an educator.

One more limit worth stating plainly. The intake form captures medication categories, not medications and doses. Category-level input cannot detect a real interaction. "Anticoagulants" does not distinguish warfarin, which is vitamin K sensitive, from a DOAC, which is not. "Antihypertensives" does not distinguish an ACE inhibitor, where potassium is a hyperkalemia risk, from a thiazide, where magnesium loss is the issue. Keeping the form free of PHI is the right call, and the cost of that call is that this tool cannot perform an interaction check at all. That check happens with the client's pharmacist or prescriber, who has the actual list. The output always includes the recommendation to review with the client's healthcare provider.

Why There Is No Dispensary Link in This Workflow

An obvious next step would be to append a link to an affiliate supplement dispensary, and plenty of build guides do exactly that. This one does not, on purpose.

The output of this workflow is generated from a client's health focus areas and medication categories. Attaching a commission-earning product link to a document built from someone's health inputs puts a financial interest inside what is supposed to be educational material, and an FTC disclosure does not remove that interest, it only discloses it. Keep the two apart. General product education can live somewhere a client's medication list never went.

The Google Sheets Logging

Every protocol request is logged to the Protocol Requests tab in the master Google Sheet. The log includes:

  • Client reference ID
  • Health focus areas
  • Medication categories
  • Dietary restrictions
  • Protocol goals
  • Timestamp

The log does not include the full protocol summary (that goes to Gmail). It is an operational record for tracking which clients have received protocol summaries and when.

The Compliance Boundary

The supplement protocol builder operates entirely in Lane 1 (non-PHI). The client reference ID is a number, not a name. The health focus areas and medication categories are general categories, not specific diagnoses or medications.

The output is an educational research summary sent to the educator, not to the client. The educator reviews it, applies their clinical judgment, and decides what to share with the client and how.

This is the correct architecture. The AI does the research acceleration. The PharmD does the clinical judgment. The client receives the educator's curated guidance, not raw AI output.

The Takeaway

The supplement protocol builder is one of the highest-value workflows in the n8n roadmap. In my own use it has cut the time I spend gathering background reading, though I have not measured that formally and your results will differ. It also raises interaction topics worth checking, and it has raised ones that turned out to be wrong. Treat the output as a list of things to verify, never as a list of things that are true.

The compliance architecture is straightforward: non-PHI inputs, educational output framing, educator review before client delivery, and clear affiliate disclosures. A pharmacology background is what lets me catch the interaction claims this tool gets wrong. If you do not have that background, the missing piece is not the workflow, it is the verification. Build the tool if it helps your reading, and route everything that touches a real client's medications to a licensed clinician who can check it.

Related reading