workflows.fit
Back to n8n workflows
n8n templateFreeBy Stéphane Bordas

Facebook Messenger Bot with GPT-4 for Text, Image & Voice Processing

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 ...

DevelopmentCore NodesAILangchainLm Chat Open AiMemory Buffer WindowTool CalculatorTool Wikipedia
Loading interactive preview...

Template notes

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, image, or audio), and routes it through the right branch. Each input is then prepared as a prompt and sent to an AI Agent that can respond using text generation, perform quick calculations, or fetch information from Wikipedia.

Finally, the answer is formatted and sent back to Messenger via the Graph API, creating a smooth, fully automated chat experience.

Set Up Steps

1. Connect credentials Add your OpenAI API key and Facebook Page Access Token in n8n credentials.

2. Plug the webhook Copy the Messenger webhook URL from your workflow and paste it into your Facebook Page Developer settings (Webhook → Messages → Subscribe).

3. Customize the agent Edit the System Message of the AI Agent to define tone, temperature, and purpose (e.g. “customer support”, “math assistant”).