π§ Tutor English chat messages using OpenRouter with Postgres memory and log to Supabase
β‘ 69 views Β· π§ Miscellaneous
Description
Quick overview
This workflow receives English practice messages via a webhook, uses an OpenRouter chat model with Postgres-backed conversation memory to generate tutoring feedback, logs the exchange to Supabase, and returns the tutorβs reply as a JSON response.
How it works
- Receives a POST webhook request containing a
user_idandmessage. - Extracts and standardizes the incoming fields so the workflow has clean
user_idandmessagevalues. - Sends the message to an AI English tutor powered by OpenRouter, using Postgres chat memory keyed by
user_idto maintain per-student context. - Logs the tutor output to a Supabase
conversationstable along with the user identifier and original message. - Returns a JSON response to the caller containing the tutorβs reply.
Setup
- Add an OpenRouter API credential and (optionally) choose a different model in the OpenRouter chat model configuration.
- Add Postgres credentials and ensure the database is reachable from n8n so chat memory can persist sessions by
user_id. - Add Supabase credentials and create a
conversationstable, then confirm the mapped columns (user_id,role,message) match your schema. - Copy the webhook URL from n8n and configure your app to POST a JSON body with
user_idandmessageto that endpoint.
π Nodes Used
Webhook, Supabase, AI Agent, Postgres Chat Memory, OpenRouter Chat Model
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File