i’m building an Ai assistant using whatsapp business api and mongodb as database, the logic of the process is : receives a chat (if phone not registred , register in User_wpp) then the Ai needs to talk telling about the tool , and perform a simple register , registering user Name and Email , the problem is that everything works fine , only the registering dont work in mongodb
Hi!
I analyzed your scenario and identified the registration problem in MongoDB. Here are the main issues and solutions:
Main Problems:
- Empty MongoDB URIs in Code nodes
- Conflict between Code nodes and MongoDB Tool nodes
- AI Agent cannot reliably manage MongoDB through
fromAIparameters
Recommended Solution:
Option 1 (Best): Remove Code nodes and use only MongoDB Tool nodes that are already connected to the AI Agent.
Option 2: Fix Code nodes by adding proper connection string through Environment Variables.
Immediate Steps:
- Add to Environment Variables:
MONGO_CONNECTION_STRING=mongodb+srv://your-connection-string
- Simplify AI system prompt - current one is too large
- Add error handling to all MongoDB operations
Testing Process:
After fixes:
- Send message from new phone number
- Verify record creation in
User_wpp - Complete registration process (name → email)
- Check field updates in MongoDB
Quick Debug Checklist:
If registration still doesn’t work:
Environment Variables set correctly?
MongoDB connection string valid?
AI Agent has access to MongoDB tools?
Phone number format consistent?
Execution logs show any errors?
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.