# Telegram bot for crypto exchange trading with OKX: n8n workflow

> Started by an incoming Telegram message, and works across Telegram. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/telegram-bot-for-crypto-exchange-trading-with-okx (Millionrounds; every figure on the page links to its filing or article)

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

# Telegram bot for crypto exchange trading with OKX

Started by an incoming Telegram message, and works across Telegram. It hands the judgement calls to OpenAI. 46 steps, 7 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftelegram-bot-for-crypto-exchange-trading-with-okx)

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

**7** Branches: places the flow splits

**0** Loops or waits

**1** Service it connects to

## The flow

Starts it 1 Model 6 Logic 25 Service 14

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

- 1 **OpenAI Chat Model2** Lm Chat Open Ai *Model*
- 2 **Call n8n Workflow Tool** Tool Workflow *Model*
- 3 **Structured Output Parser** Output Parser Structured *Model*
- 4 **Telegram trigger** Telegram trigger *Starts it*
- 5 **AI Agent** Agent *Model*
- 6 **Merge callback data** Merge *Logic*
- 7 **Switch** Switch *Logic*
- 8 **Switch order type** Switch *Logic*
- 9 **Switch callback action** Switch *Logic*
- 10 **Download audio file** Telegram *Service*
- 11 **Introduce to the service** Telegram *Service*
- 12 **Pass through message text** Set *Logic*
- 13 **Convert callback data to command** Set *Logic*
- 14 **Prepare limit order body** Set *Logic*
- 15 **Prepare market order body** Set *Logic*
- 16 **Reply with order type error** Telegram *Service*
- 17 **Prepare cancel order request** Set *Logic*
- 18 **Answer to callback** Telegram *Service*
- 19 **OpenAI transcriber** Open Ai *Model*
- 20 **Reply with file download error** Telegram *Service*
- 21 **Normalize text field** Set *Logic*
- 22 **Extract callback command entities** Set *Logic*
- 23 **Prepare post order request** Set *Logic*
- 24 **Cancel an order** Execute Workflow *Logic*
- 25 **OpenAI intents parser** Open Ai *Model*
- 26 **Place an order** Execute Workflow *Logic*
- 27 **If cancelled** If *Logic*
- 28 **Switch intent** Switch *Logic*
- 29 **If order was placed** If *Logic*
- 30 **Reply to cancel order with success message** Telegram *Service*
- 31 **Reply to cancel order with OKX API result** Telegram *Service*
- 32 **Prepare list orders request** Set *Logic*
- 33 **Prepare list assets request** Set *Logic*
- 34 **Reply with intent parsing error** Telegram *Service*
- 35 **Format order data2** Code *Logic*
- 36 **Reply to command with OKX error message** Telegram *Service*
- 37 **Delete order info from the chat** Telegram *Service*
- 38 **List orders** Execute Workflow *Logic*
- 39 **List assets** Execute Workflow *Logic*
- 40 **Reply to command with OKX API result** Telegram *Service*
- 41 **Split out orders** Split Out *Logic*
- 42 **Reply with assets listing** Telegram *Service*
- 43 **If** If *Logic*
- 44 **Format order data1** Code *Logic*
- 45 **Reply with empty orders message** Telegram *Service*
- 46 **Reply with order data** Telegram *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 46, with 7 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Telegram
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Telegram account, 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. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 46 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 46 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%2Ftelegram-bot-for-crypto-exchange-trading-with-okx)
- **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.

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

## Workflows like it

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

- [**AI advanced automation agent with Azure OpenAI and Gmail** 45 steps · calls a model · Gmail, Telegram](https://millionrounds.com/workflow/ai-advanced-automation-agent-with-azure-openai-and-gmail)
- [**Smart kitchen & inventory assistant with OpenAI** 43 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/smart-kitchen-and-inventory-assistant-with-openai)
- [**Attendance system with OpenAI and Google Sheets** 41 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/attendance-system-with-openai-and-google-sheets)
- [**Generate consensus-based answers with Claude and OpenAI** 41 steps · calls a model · Gmail, Slack](https://millionrounds.com/workflow/generate-consensus-based-answers-with-claude-and-openai)
- [**Forex AI trading assistant for Telegram with Position Sizing** 40 steps · calls a model · Telegram](https://millionrounds.com/workflow/forex-ai-trading-assistant-for-telegram-with-position-sizing)
- [**Automate YouTube Shorts creation from Telegram prompts** 39 steps · calls a model · Google Drive, Telegram](https://millionrounds.com/workflow/automate-youtube-shorts-creation-from-telegram-prompts)
