Skip to main content

Check prescription safety and drug interactions with GPT-4o, Sheets, and Telegram

Workflow preview

Workflow preview
100%
Check prescription safety and drug interactions with GPT-4o, Sheets, and Telegram preview
Open on n8n.io

1. Workflow Overview

Quick overview This workflow monitors a Google Drive folder for new prescription PDFs, extracts the text, uses OpenAI (GPT 4o mini) to structure prescription details and draft a SOAP note, checks d...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.telegram, n8n-nodes-base.googledrivetrigger, n8n-nodes-base.googledrive, n8n-nodes-base.googlesheets

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Rahul Joshi.

Original n8n.io source

1.1 Workflow description

Title
Check prescription safety and drug interactions with GPT-4o, Sheets, and Telegram
Workflow name
Check prescription safety and drug interactions with GPT-4o, Sheets, and Telegram

Quick overview

This workflow monitors a Google Drive folder for new prescription PDFs, extracts the text, uses OpenAI (GPT-4o-mini) to structure prescription details and draft a SOAP note, checks drugs against Google Sheets formulary and interaction tables, and notifies a pharmacist or patient via Telegram, with Slack error alerts.

How it works

  1. Triggers when a new PDF is created in a specified Google Drive folder.
  2. Downloads the PDF and extracts its text content.
  3. Sends the extracted text to OpenAI (GPT-4o-mini) to return structured patient/prescription fields, a drug list, and a drafted SOAP note as JSON.
  4. Loads the approved formulary and the drug-interaction pairs from Google Sheets and cross-checks the prescribed drugs to detect off-formulary items and known interactions.
  5. If issues are found, sends a detailed Telegram alert to the pharmacist and appends the case to the Google Sheets FlaggedPrescriptions tab for auditing.
  6. If no issues are found, logs the prescription to the Google Sheets Prescriptions tab and sends a Telegram confirmation to the patient.
  7. If any node errors, posts an error message with execution details to a Slack channel.

Setup

  1. Connect Google Drive OAuth2 credentials and set the folder ID in the Google Drive trigger to the intake folder for prescription PDFs.
  2. Add an OpenAI API credential and confirm the model selection (default: gpt-4o-mini) meets your needs.
  3. Connect Google Sheets OAuth2 credentials and create/update a spreadsheet with tabs named Formulary, Interactions, Prescriptions, and FlaggedPrescriptions, then set the spreadsheet ID in the Google Sheets nodes.
  4. Configure a Telegram bot credential and replace the pharmacist and patient chatId values used in the two Telegram messages.
  5. Connect Slack OAuth2 credentials and set the target Slack channel ID for workflow error alerts.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Overview: Prescription Safety Checker

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Section: Trigger & PDF Extraction

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Section: AI Extraction & SOAP Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Section: Formulary & Interaction Checks

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Section: Alert & Logging (Flagged)

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Section: Confirmation & Logging (Cleared)

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Credentials & Security

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - GPT-4o – Extract + Draft SOAP Note

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.4

Block 9 - Parse & Validate GPT Response

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Route: Flagged or Cleared?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 11 - Telegram – Alert Pharmacist

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 12 - Telegram – Notify Patient

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 13 - Watch Prescriptions Folder

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 14 - Download PDF from Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 15 - Read Approved Drug Formulary

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 16 - Read Drug Interactions Table

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 17 - Check Formulary & Flag Interactions

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 18 - Log Flagged Prescription to Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 19 - Log Cleared Prescription to Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 20 - Extract Text from PDF

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1.1

Block 21 - Merge Formulary & Interactions

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 22 - On Workflow Error

Type / Role
n8n-nodes-base.errorTrigger - errorTrigger
Config choices
Version 1

Block 23 - Slack – Send Error Alert

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 24 - Section: Error Handler

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Check prescription safety and drug interactions with GPT-4o, Sheets, and Telegram
Complexity advanced
Nodes 24
Categories Document Extraction, AI Summarization
Author Rahul Joshi
Published 17 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16458/16458.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Check prescription safety and drug interactions with GPT-4o, Sheets, and Telegram do?

Quick overview This workflow monitors a Google Drive folder for new prescription PDFs, extracts the text, uses OpenAI (GPT 4o mini) to structure prescription details and draft a SOAP note, checks d...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Summarization use case.