ManyChat + Make + OpenAI chatbot sends wrong/old answer to Instagram despite correct GPT response

:bullseye: What is your goal?

I have a working AI chatbot: ManyChat (Instagram) → 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.

:thinking: What is the problem & what have you tried?

When a user sends a message, Make runs two parallel executions simultaneously. Both executions call OpenAI and both update the ai_answer custom field in ManyChat via HTTP module (setCustomField). The second execution overwrites the correct answer with an old one. The user receives the wrong response in Instagram even though the Make History shows the correct GPT answer was generated.

What I have tried:

  1. Anti-duplicate filter using last_processed field in Data Store — reduces duplicates but does not prevent the race condition completely
  2. Sequential processing in scenario settings — conflicts with Webhook Response module, causes error: “Response can’t be processed when scenario is not executed immediately on data arrival”
  3. Webhook Response with {“reply”: “8.reply”} — works for delivering answers but does not prevent parallel executions
  4. is_processing flag concept — have not implemented yet, not sure if it solves the race condition

My current scenario structure:
Webhooks[1] → Data Store Search[2] → Anti-duplicate filter → OpenAI[7] → JSON[8] → HTTP (setCustomField ai_answer)[31] → Data Store Update[33] → Router → Webhook Response[22] (dialog branch)

The root problem: two parallel Make executions both update ai_answer — the second one overwrites the correct answer from the first. ManyChat then sends the stale value to the user.

Question: What is the correct way to prevent parallel webhook executions from overwriting each other’s data in Data Store / ManyChat custom fields? Is the is_processing boolean flag in Data Store a reliable solution, and if yes, how to implement it correctly to avoid race conditions?

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

This looks like a race condition after the OpenAI step, not an OpenAI problem.

Two webhook executions are running in parallel and both update the same ai_answer field. The later write wins, even if it belongs to an older/duplicate message.

I would avoid using one shared ai_answer field as the source of truth. Instead, treat each incoming ManyChat message as its own job:

  1. Create a unique message_id/conversation_id from the incoming payload.
  2. Before OpenAI, create a Data Store record with status=processing and that message_id.
  3. If that message_id already exists, stop the duplicate execution.
  4. Store the GPT answer under that message_id.
  5. In the response step, map the answer from the current execution/message_id, not from a shared ManyChat custom field.

If GPT generated the correct answer but Instagram received an old one, the stale value is probably introduced after GPT: Data Store, setCustomField, or the final ManyChat mapping.