← العودة
Blog Post
عنوان المحادثة: Fix deployed and verified. Here's the summary:Root cause: In processRe...
التاريخ: 12.04.2026
التصنيف: 🧠 الذكاء الاصطناعي وتعلم الآلة
إجمالي الرسائل: 5 | ياسر: 4 | M: 1
Yasser
Fix deployed and verified. Here's the summary:Root cause: In processResponseCode (Process AI Response node), line 1438 used bare role variable which was never defined in that code node — it was only defined in aiPromptCode (Build AI Prompt), a separate n8n code node. This caused ReferenceError: role is not defined whenever سفيان tried to execute commands like "جدول استلام طلب 1".Fix: Changed role === 'ethiopia_ops' → teamMember?.role === 'ethiopia_ops' at build.js:1438, consistent with all other role checks in processResponseCode (lines 1594, 1698, 1733, 1873, 1920, 1994 all already used teamMember?.role).Both issues resolved:Bot calling سفيان "ميره" — was already fixed by the prior deployment (team lookup now works correctly, confirmed in exec 126315)Commands not executing — fixed now. The schedule_pickup action handler will no longer crash.
Yasser
Found it! أحمد's phone is +9627967021944 — there's an extra 4 at the end! Should be +962796702194. That's why find_team_by_phone fails!
Yasser
Both fixes are deployed and verified:loadTeamQuery now includes manychat_subscriber_id — the notification workflow's Load Team SQL now fetches this column, so Prepare Recipients can find each team member's ManyChat subscriber ID directly from the DB.Has Payload? condition changed from exists → isNotEmpty — empty subscriber_id strings (from skipped/invalid recipients) are now correctly filtered out, preventing the Send ManyChat node from receiving undefined sendBody and crashing with "not valid JSON".The root cause was: when سفيان did confirm_pickup, the team notification tried to send via ManyChat but the Load Team query didn't include manychat_subscriber_id → fallback phone lookup failed (أحمد's phone was wrong at the time) → empty subscriber_id passed through the "exists" check → JSON.stringify(undefined) → crash. Both layers are now fixed.
Yasser
الإشعار وصل لسفيان. المشكلة كانت إنها مشكلتين:isNotEmpty مش operation صحيح بـ n8n — كان يرفض كل الإشعارات (Has Payload? كان يرجع 0 items). غيرته لـ notEquals "" وهلا شغال.رقم أحمد بالـ DB لسه غلط +9627967021944 (رقم زيادة) — صلحته مرة ثانية لـ +962796702194.التجربة اللي عملتها (pickup_ready) وصلت لسفيان بنجاح:Prepare Recipients → سفيان (+962798087441, MC: 1914590202)Has Payload? → مر (1 item)Send ManyChat → status: success, HTTP 200
المحادثة الكاملة - 12.04.2026
M
من اسمه aiacademy
12.04.2026 17:47
ياسر
Fix deployed and verified. Here's the summary:Root cause: In processResponseCode (Process AI Response node), line 1438 used bare role variable which was never defined in that code node — it was only defined in aiPromptCode (Build AI Prompt), a separate n8n code node. This caused ReferenceError: role is not defined whenever سفيان tried to execute commands like "جدول استلام طلب 1".Fix: Changed role === 'ethiopia_ops' → teamMember?.role === 'ethiopia_ops' at build.js:1438, consistent with all other role checks in processResponseCode (lines 1594, 1698, 1733, 1873, 1920, 1994 all already used teamMember?.role).Both issues resolved:Bot calling سفيان "ميره" — was already fixed by the prior deployment (team lookup now works correctly, confirmed in exec 126315)Commands not executing — fixed now. The schedule_pickup action handler will no longer crash.
12.04.2026 18:03
ياسر
Found it! أحمد's phone is +9627967021944 — there's an extra 4 at the end! Should be +962796702194. That's why find_team_by_phone fails!
12.04.2026 19:11
ياسر
Both fixes are deployed and verified:loadTeamQuery now includes manychat_subscriber_id — the notification workflow's Load Team SQL now fetches this column, so Prepare Recipients can find each team member's ManyChat subscriber ID directly from the DB.Has Payload? condition changed from exists → isNotEmpty — empty subscriber_id strings (from skipped/invalid recipients) are now correctly filtered out, preventing the Send ManyChat node from receiving undefined sendBody and crashing with "not valid JSON".The root cause was: when سفيان did confirm_pickup, the team notification tried to send via ManyChat but the Load Team query didn't include manychat_subscriber_id → fallback phone lookup failed (أحمد's phone was wrong at the time) → empty subscriber_id passed through the "exists" check → JSON.stringify(undefined) → crash. Both layers are now fixed.
12.04.2026 19:48
ياسر
الإشعار وصل لسفيان. المشكلة كانت إنها مشكلتين:isNotEmpty مش operation صحيح بـ n8n — كان يرفض كل الإشعارات (Has Payload? كان يرجع 0 items). غيرته لـ notEquals "" وهلا شغال.رقم أحمد بالـ DB لسه غلط +9627967021944 (رقم زيادة) — صلحته مرة ثانية لـ +962796702194.التجربة اللي عملتها (pickup_ready) وصلت لسفيان بنجاح:Prepare Recipients → سفيان (+962798087441, MC: 1914590202)Has Payload? → مر (1 item)Send ManyChat → status: success, HTTP 200
12.04.2026 20:06
← العودة إلى الرئيسية