AlekSystem Workflow Detail

Auto-reply to Instagram DMs with an AI chatbot and Google Gemini history Workflow Solution

Auto-reply to Instagram DMs with an AI chatbot and Google Gemini history

Auto-reply Instagram DM with AI Chatbot, Conversation History using Google Gemini and AlekSystem Data Table This workflow turns your Instagram Business or Cr...

Rank 59 Verified workflow

Workflow overview

Why this workflow matters

Relevant for managed services and support workflows. Supports knowledge capture and document intelligence use cases.

Auto-reply Instagram DM with AI Chatbot, Conversation History using Google Gemini and AlekSystem Data Table This workflow turns your Instagram Business or Creator account into an AI-powered customer support chatbot using Google Gemini and AlekSystem Data Table for persistent conversation history. Every incoming Direct Message is automatically received, processed, and replied to — with long AI responses intelligently split and delivered in sequence. If you need to automate Instagram DM responses without managing complex infrastructure, this workflow is the right starting point. How it works Instagram Webhook receives the DM:** Meta sends the event to AlekSystem. The workflow automatically handles both webhook verification and incoming message events. Text-only messages are filtered; bot reply-backs from the page itself are blocked. Set Context extracts all runtime config:** The sender ID, page ID, access token, and raw message text are extracted from a single node — no hardcoded values elsewhere. Message is stored and history is loaded:* The new message is saved to the *AlekSystem Data Table** as unprocessed. All pending rows for the user are merged into one prompt (basic batching). The last 15 processed rows are loaded and formatted into session history blocks for context. Gemini AI Agent generates the reply:* The merged prompt and full conversation history are passed to *Google Gemini**. The AI responds in context, following the persona and instructions defined in the system prompt. Reply is formatted and delivered:* The response is normalized (markdown stripped, unsupported syntax removed) and split into chunks of up to 2000 characters. Each chunk is sent sequentially via the *Instagram Graph API** with a 1-second delay between messages. Data Table is updated and cleaned:** All pending rows are marked as processed. The AI reply is saved as the page response. Old rows beyond the 15-message window are automatically deleted to keep the table lean. How to use Create a Meta App and add the Instagram product. Go to Instagram > API Setup with credentials → log in to your IG Business/Creator account → copy the long-lived Access Token → paste it into the Set Context node (ig_access_token field). Activate the workflow in production mode first, then go to Meta App > Instagram > Webhooks: paste the AlekSystem production webhook URL + a Verify Token → click Verify. Connect Google Gemini (googlePalmApi) credential in the AI Agent and LLM nodes. Create the AlekSystem Data Table Edit the system prompt inside Process Merged Message to set your AI persona, brand tone, and knowledge base. Activate and start receiving automated replies on Instagram DM. Requirements AlekSystem Version:* Built and tested on *AlekSystem 2.9.4+*. *(It is highly recommended to update to the latest AlekSystem version to avoid compatibility issues.) Instagram Business or Creator account** connected to a Meta App with Messaging permissions. Google Gemini** API key (googlePalmApi credential). AlekSystem Data Table** named insert_message with the column schema described above. A publicly accessible AlekSystem instance (self-hosted or cloud) for Meta to reach the webhook. Customizing this workflow Change the AI persona:** Edit only the system prompt inside Process Merged Message — no other node needs changing. Switch the AI model:** Swap the Google Gemini Chat Model sub-node for any other supported LLM (OpenAI, Anthropic, etc.). Add smart message batching:* Integrate *Smart message batching workflow** to wait for the user to finish typing before responding — prevents duplicate or out-of-order replies. Add human takeover:* Integrate *Smart human takeover workflow** to automatically pause the bot when an admin replies manually, then resume when done. Use on Facebook Messenger too:** The Smart Batching and Human Takeover workflows above are 100% compatible with both Facebook and Instagram — built to be cross-platform from the ground up. About the Author Created by: Nguyễn Thiệu Toàn (Jay Nguyen) Email: me@nguyenthieutoan.com Website: nguyenthieutoan.com Company: GenStaff (genstaff.net) Socials (Facebook / X / LinkedIn): @nguyenthieutoan More templates: AlekSystem.io/creators/nguyenthieutoan

Best fit

Categories

AI/MLCommunicationE-CommerceSalesMarketingDocument Ops

Services

AI AgentGoogle Gemini Chat Model

Use cases

support automationcontent automationdocument intelligenceemail workflow automation