# Explain pasted code and follow-up questions with OpenAI: n8n workflow

> Started by another system calling it, and works across Discord and Slack. It puts OpenAI behind a retrieval step, so answers are drawn from documents you...

Source: https://millionrounds.com/workflow/explain-pasted-code-and-follow-up-questions-with-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [CRM](https://millionrounds.com/workflows?category=CRM#library)

# Explain pasted code and follow-up questions with OpenAI

Started by another system calling it, and works across Discord and Slack. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 19 steps, 4 branches, 1 loop or waits: a working afternoon to understand properly.

Medium Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fexplain-pasted-code-and-follow-up-questions-with-openai)

**19 steps** Medium: a working afternoon

**4** Branches: places the flow splits

**1** Loop or waits

**2** Services it connects to

## The flow

Starts it 3 Model 4 Logic 10 Service 2

The steps in the order they run, from what starts it.

- 1 **Webhook - Code Submitted** Webhook *Starts it*
- 2 **Tool - Analyze Code Structure** Tool Code *Model*
- 3 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 4 **Window Buffer Memory** Memory Buffer Window *Model*
- 5 **Set - Config** Set *Logic*
- 6 **AI Agent - Code Explainer** Agent *Model*
- 7 **Switch - Audience Level** Switch *Logic*
- 8 **Set - Parse Agent Output** Set *Logic*
- 9 **Set - Beginner Explanation Style** Set *Logic*
- 10 **Set - Expert Explanation Style** Set *Logic*
- 11 **Set - Intermediate Explanation Style** Set *Logic*
- 12 **IF - Security Concern Flagged** If *Logic*
- 13 **Wait - For Expert Security Review** Wait *Logic*
- 14 **Switch - Output Channel** Switch *Logic*
- 15 **IF - Review Approved** If *Logic*
- 16 **Slack - Send Code Explanation (optional)** Slack *Service*
- 17 **Discord - Send Code Explanation (optional)** Discord *Service*
- 18 **Respond to Webhook - Return Explanation** Respond To Webhook *Starts it*
- 19 **Respond to Webhook - Blocked** Respond To Webhook *Starts it*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 19, with 4 branches, 1 loop or waits
- **Size:** Medium: a working afternoon
- **Connects to:** Discord, Slack
- **Model:** OpenAI
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Discord and Slack accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 19 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 19 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fexplain-pasted-code-and-follow-up-questions-with-openai)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Discord](https://millionrounds.com/workflows?service=Discord#library)[Slack](https://millionrounds.com/workflows?service=Slack#library)

## Workflows like it

Also crm, with the same services where possible, closest in size first.

- [**Sync weekly Odoo sales KPIs with Google Sheets and Slack** 19 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/sync-weekly-odoo-sales-kpis-with-google-sheets-and-slack)
- [**Block noindex SEO regressions in deploy pipelines with Slack** 19 steps · Slack](https://millionrounds.com/workflow/block-noindex-seo-regressions-in-deploy-pipelines-with-slack)
- [**Find and analyze salvage car deals with Google Sheets** 18 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/find-and-analyze-salvage-car-deals-with-google-sheets)
- [**GPT-4o: Twilio integration with OpenAI and Airtable** 20 steps · calls a model · Airtable, Email](https://millionrounds.com/workflow/gpt-4o-twilio-integration-with-openai-and-airtable)
- [**CallForge - 04 - AI workflow for Gong.io sales calls** 18 steps · Notion, Slack](https://millionrounds.com/workflow/callforge-04-ai-workflow-for-gong-io-sales-calls)
- [**Generate style-locked Seedance videos with Gmail and Jira** 18 steps · Gmail, Jira](https://millionrounds.com/workflow/generate-style-locked-seedance-videos-with-gmail-and-jira)
