Engati - User Guide
...
MongoDB Search Custom Script
Setup Guide
6 min
follow the steps below to configure and store data using a custom script for mongodb in the generative ai documents section step 1 — navigate to generative ai documents go to the train → generative ai → documents section click upload document to add a new data source for storage step 2 — select custom as content source in the configure documents to your knowledge base screen, choose custom as the content source this option allows you to upload a python script that fetches external data and converts it into structured json for mongo storage provide the required information for the script configuration script title enter a descriptive name for the custom script example doctor details mongo category select a category to organize the indexed document language choose the language used in the indexed content step 3 — add the custom script in the custom indexing section, paste the python script that retrieves and formats the external data the script should fetch data from the external source (api, google sheets, sitemap, etc ) convert the data into structured json return the json output using sys stdout write for mongo storage, the response should use the data to save field this json output will be used by the platform to store the content in mongodb step 4 — configure auto refresh (optional) you can enable autorefresh to automatically update the stored data enable the autorefresh toggle and set the refresh interval (in days) example refresh interval 7 days this ensures the script runs periodically and updates the stored data with the latest information after entering the details, click continue step 5 — review and confirm setup review the configuration before starting the storage process verify the following script title category language content source indexing configuration autorefresh settings once confirmed, click save & start indexing step 6 — verify document status after processing completes, the document will appear in the generative ai documents list the status will show 📚 next steps once the mongo db indexing status shows ready to search, configure the agent workflow so the ai can retrieve knowledge from the indexed website content ➡️ continue with docid\ mghub2ljg7trzpintcz2d
