Facebook Messenger Bot with GPT-4 for Text, Image & Voice Processing
Needs changesWhat this workflow does
This AI workflow has 18 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects OpenAI Chat Model, Wikipedia and OpenAI. It also calls graph.facebook.com over HTTP.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Identify Message Type (Function): runs custom JavaScript (legacy Function node)
- Identify and ReRoute Message Types (Switch): routes items into 3 branches
- Download Image (HTTP Request): calls an HTTP API
- Download Audio (HTTP Request): calls an HTTP API
- Edit Fields (Edit Fields (Set)): sets 1 field: user_prompt
- Analyze image (OpenAI): analyze (image)
- Audio Transcriber (OpenAI): transcribe (audio)
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; 2 tools (Wikipedia, Calculator); memory: Simple Memory
- Edit Fields (Edit Fields (Set)): sets 1 field: user_prompt
- Edit Fields (Edit Fields (Set)): sets 1 field: user_prompt
…plus 3 more steps. See the full node list below.
Services it uses
HTTP calls to: graph.facebook.com
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- Function (legacy) in Identify Message Type: replace with Code node, mode 'Run Once for All Items'.
| Removed in 3.0 | Replace with |
|---|---|
| Function (legacy) Identify Message Type | Code node, mode 'Run Once for All Items' |
Nodes used (12)
- OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Calculator
@n8n/n8n-nodes-langchain.toolCalculator - Wikipedia
@n8n/n8n-nodes-langchain.toolWikipedia - HTTP Request
n8n-nodes-base.httpRequest - OpenAI
@n8n/n8n-nodes-langchain.openAi - Switch
n8n-nodes-base.switch - Function
n8n-nodes-base.function - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - AI Agent
@n8n/n8n-nodes-langchain.agent - Webhook
n8n-nodes-base.webhook
From the author
How it Works This workflow lets you build a Messenger AI Agent capable of understanding text, images, and voice notes, and replying intelligently in real time. It starts by receiving messages from a Facebook Page via a Webhook, detects the message type (text,…