What is your goal?
I have a working AI chatbot: ManyChat (Instagram; WhatsApp) β Make β OpenAI GPT-4 β ManyChat. The chatbot answers customer questions 24/7. My goal is to ensure that every customer receives the correct and current AI-generated response β not an old cached answer from a previous message.
What is the problem & what have you tried?
Hi everyone. I have a complex issue with ManyChat + Make + OpenAI chatbot
for Instagram. I need help solving two critical problems.
βββββββββββββββββββββββββββββββ
SYSTEM ARCHITECTURE
βββββββββββββββββββββββββββββββ
Platform: ManyChat (Instagram) + Make + OpenAI GPT-4o-mini
Make scenario flow:
Webhooks[1] (Custom webhook, instant trigger)
β Data Store[2] Search records (search by user_id = sender_id)
β Anti-duplicate filter:
Condition 1: sender_id + β" + message != last_processed
Condition 2: sender_id + "β + message != last_msg
β OpenAI[7] (GPT-4o-mini, JSON mode, generates reply)
β JSON[8] (Parse JSON, extracts βreplyβ field as 8.reply)
β Data Store[33] Update record (saves history, last_processed,
last_msg = sender_id+β_β+message, name, phone, language)
β Router[11]
Branch 1 βbookingβ: Data Store β Google Sheets β Telegram Bot
β Webhooks[25] Webhook Response
Branch 2 βdialogβ: Webhooks[22] Webhook Response
body = {βreplyβ: β{{8.reply}}β}
Data Store structure:
user_id (Text), history (Text), name (Text), phone (Text),
detected_language (Text), last_update (Date),
last_processed (Text), last_msg (Text), is_processing (Boolean)
ManyChat Flow structure:
Trigger: Default Reply + Another flow (language selection flow)
β Condition: chosen_language has any value
β YES branch: External Request (POST to Make webhook,
body: sender_id, message, language)
β Send Message {{ai_answer}}
β NO branch: Start Automation βLanguage Selection Flowβ
ManyChat Response Mapping:
JSONPath: βreplyβ β Custom Field: ai_answer
βββββββββββββββββββββββββββββββ
PROBLEM 1 β RACE CONDITION (Main Problem)
βββββββββββββββββββββββββββββββ
What happens:
User sends a message. ManyChat triggers two parallel executions
in Make simultaneously (or within milliseconds of each other).
Both executions:
- Read Data Store at the same time
- Both see last_processed = old value (not yet updated)
- Both PASS the anti-duplicate filter
- Both call OpenAI
- Both send Webhook Response to ManyChat
- ManyChat receives two responses
Result: User receives the WRONG answer β the response from the
OLDER parallel execution (which contains a stale/previous answer),
not the current correct one.
Example from real test:
- User asks βWhat services do you have?β
- Make History shows OpenAI gave correct answer about services
- User receives in Instagram: βNice to meet you, Roma! How can I help?β
(this was the answer from a PREVIOUS message)
What I already tried:
- Anti-duplicate filter with last_processed β both executions read
the same old value simultaneously, both pass the filter - Added second filter field last_msg β same problem, race condition
still occurs - Sequential Processing in Make settings β conflicts with
Webhook Response module, causes error:
βResponse canβt be processed when scenario is not executed
immediately on data arrivalβ - Removed HTTP setCustomField module (was updating ai_answer
via ManyChat API) β problem persists - Added is_processing Boolean field to Data Store β
not fully implemented yet
Previous expert advice I received:
βCreate unique message_id. Before OpenAI, create Data Store record
with status=processing and that message_id. If message_id already
exists β stop the duplicate execution. Map answer from current
execution, not from shared ManyChat field.β
I understand the concept but need help with exact Make implementation:
- Which modules to use and in what exact order?
- How to check if message_id exists AND stop the execution if it does?
- Data Store βAdd a recordβ or βUpdate a recordβ for the flag?
- How to handle the case where is_processing gets stuck as true
if execution fails?
βββββββββββββββββββββββββββββββ
PROBLEM 2 β NO RESPONSE AFTER LANGUAGE SELECTION
βββββββββββββββββββββββββββββββ
What happens:
User sends first message (e.g. βHelloβ)
β ManyChat shows language selection buttons (Russian/Kazakh/English)
β User clicks βRussianβ
β Make scenario triggers and runs (all modules show green in History)
β OpenAI generates correct response (visible in Make History)
β Data Store saves correct history
β BUT user receives NO message in Instagram at all
β User waits 3+ minutes, nothing arrives
This happens approximately 30-40% of the time on first language selection.
When user clicks βRussianβ a second time β response arrives correctly.
My analysis: ManyChat sends the webhook request and waits for
Webhook Response. The scenario runs but something in the timing
causes ManyChat to not receive or not process the Webhook Response
correctly on the first attempt.
Possible cause: When user clicks language button, ManyChat may
send the webhook before the Flow is fully ready to process
the response, or thereβs a timing issue between the language
selection trigger and the External Request execution.
βββββββββββββββββββββββββββββββ
WHAT I NEED
βββββββββββββββββββββββββββββββ
-
Exact step-by-step implementation of message_id /
is_processing mutex lock in Make to prevent race condition -
Which Make modules to use:
Data Store βSearchβ β filter β βAdd recordβ with processing flag?
Or different approach? -
How to solve the βno response on first language selectionβ issue
-
Should I keep or remove the Webhook Response module?
If remove β how to send response back to ManyChat correctly
for Instagram (aware of Message Tag limitations)?
Thank you very much for any help.
