Latenode

Discord bot with GPT-4o-mini and Redis conversation history

This template watches a Discord channel, loads recent turns from Latenode Database, asks ChatGPT for a reply, saves the new turn, and posts the answer in Discord.

Connect Discord. Put the bot token on the Discord connection. ChatGPT is Latenode AI, so you do not paste an OpenAI key. Skip the bot's own messages so the run does not loop.

Updated Sep 15, 2026Est. run: 20sEst. cost: $0.0013
How Latenode estimates time and cost

Latenode bills workflow runtime in CPU seconds. The first 10,000 CPU seconds are free each month, then usage follows pay-as-you-go CPU-second pricing. Plug-and-Play (PnP) AI nodes are billed separately—each PnP token is $1 USD, charged pay-as-you-go at vendor cost plus a small processing fee, with no API keys required.

Full pricing — how CPU seconds work →

Workflow preview

What this template does

  • Replies to Discord messages with ChatGPT
  • Keeps conversation context in Latenode Database
  • Posts the answer in the same channel
  • Uses Latenode ChatGPT, so you do not paste an OpenAI key

How it works

1
Trigger

New Discord message

The scenario starts when a message arrives in the Discord channel you watch.

2
Logic

Load conversation history

JavaScript skips the bot's own messages. Latenode Database returns recent turns for that channel or user.

3
AI

Write the reply

ChatGPT reads the new message plus history and returns a reply. ChatGPT is Latenode AI, so you do not paste an OpenAI key.

4
Action

Save and post

Latenode Database stores the new turn. Discord posts the reply in the same channel.

Setup guide

1

Connect Discord

Add a Discord bot connection. Invite the bot to the server and pick the channel it should read and reply in. Put the bot token on the Discord connection.

2

Store history in Latenode Database

Create a table for channel or user id, role, and message text. Load recent rows before ChatGPT, then create or update a row after each turn.

3

Reply with ChatGPT

Send the current message plus history to ChatGPT, then send a Discord message in that channel. ChatGPT is a Latenode AI node. You do not paste an OpenAI key. Skip messages sent by the bot.

Requirements

A Discord bot token stored on the Discord connection
A channel the bot can read and post in
A Latenode Database table for conversation turns

FAQ

Common questions about this template

Each run uses credits on your Latenode plan. We charge for processing time (1 credit = 30 seconds). Your actual cost depends on your plan and how long the run takes. See pricing plans for plans and how credits work. Plug-and-Play AI nodes are billed separately.