# Process voice, images & documents with OpenAI and MongoDB: n8n workflow

> Started by an incoming Telegram message, and works across Gmail and Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from documents...

Source: https://millionrounds.com/workflow/process-voice-images-and-documents-with-openai-and-mongodb (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Process voice, images & documents with OpenAI and MongoDB

Started by an incoming Telegram message, and works across Gmail and Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 21 steps, 2 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fprocess-voice-images-and-documents-with-openai-and-mongodb)

**21 steps** Large: read it before trusting it with anything live

**2** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 1 Model 5 Logic 7 Service 8

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

- 1 **Telegram Trigger** Telegram trigger *Starts it*
- 2 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 3 **MongoDB Chat Memory** Memory Mongo Db Chat *Model*
- 4 **Send a message in Gmail** Gmail Tool *Service*
- 5 **Search for a messages in Gmail** Gmail Tool *Service*
- 6 **Switch** Switch *Logic*
- 7 **AI Agent** Agent *Model*
- 8 **Get photo file** Telegram *Service*
- 9 **Get audio file** Telegram *Service*
- 10 **Get a file** Telegram *Service*
- 11 **Get text from Message** Set *Logic*
- 12 **Respond** Telegram *Service*
- 13 **ConvertAPI HTTP Request** Http Request *Service*
- 14 **Transcribe a recording** Open Ai *Model*
- 15 **If** If *Logic*
- 16 **Analyze image** Open Ai *Model*
- 17 **Get text from Audio** Set *Logic*
- 18 **Extract from File** Extract From File *Service*
- 19 **Unsupported Input** Set *Logic*
- 20 **Get text from Image** Set *Logic*
- 21 **Get text from PDF** Set *Logic*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 21, with 2 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Telegram
- **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 Gmail and Telegram accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming Telegram message.

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?

Take your time. At 21 steps it is large: read it before trusting it with anything live.

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 21 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%2Fprocess-voice-images-and-documents-with-openai-and-mongodb)
- **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.

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

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**Track contract signatures and onboard clients with Airtable** 21 steps · calls a model · Airtable, Gmail](https://millionrounds.com/workflow/track-contract-signatures-and-onboard-clients-with-airtable)
- [**Automate legal lien documents with Gemini and Apify** 22 steps · calls a model · Gmail, Google Docs](https://millionrounds.com/workflow/automate-legal-lien-documents-with-gemini-and-apify)
- [**Classify and file email PDF documents with Gmail and Drive** 22 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/classify-and-file-email-pdf-documents-with-gmail-and-drive)
- [**Financial document extraction from Gmail to Google Sheets** 20 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/financial-document-extraction-from-gmail-to-google-sheets)
- [**Generate DOCX documents from Gmail with OpenAI** 20 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/generate-docx-documents-from-gmail-with-openai)
- [**Transcribing Telegram voice messages with Whisper and Gemini** 20 steps · calls a model · Telegram](https://millionrounds.com/workflow/transcribing-telegram-voice-messages-with-whisper-and-gemini)
