Mongodb assitant , don't update my data

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:

:police_car_light: Main Problems:

  1. Empty MongoDB URIs in Code nodes
  2. Conflict between Code nodes and MongoDB Tool nodes
  3. AI Agent cannot reliably manage MongoDB through fromAI parameters

:white_check_mark: 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.

:wrench: Immediate Steps:

  1. Add to Environment Variables:
MONGO_CONNECTION_STRING=mongodb+srv://your-connection-string
  1. Simplify AI system prompt - current one is too large
  2. Add error handling to all MongoDB operations

:bullseye: 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

:light_bulb: Quick Debug Checklist:

If registration still doesn’t work:

  • :white_check_mark: Environment Variables set correctly?
  • :white_check_mark: MongoDB connection string valid?
  • :white_check_mark: AI Agent has access to MongoDB tools?
  • :white_check_mark: Phone number format consistent?
  • :white_check_mark: Execution logs show any errors?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.