Simplest way to let OpenAI search an external legal API during a workflow?

:bullseye: What is your goal?

Hi everyone,I am building a simple, linear workflow in Make.com:[Customer input] ➔ [OpenAI Specialist Module] ➔ [Send Gmail].I just got API access to an official legal case database. I want my OpenAI Specialist (using a newer GPT model like o4-mini or GPT-4o) to analyze the customer’s text first, and then automatically search the legal API for the right court cases based on that analysis.What is the easiest and most practical way to do this in Make?Can it be done simply by writing it inside the system prompt?Do I need to upgrade to a specific newer GPT module version in Make?Which specific Make modules or settings should I add to connect the API so the AI can use it directly?Please keep the answers simple and easy to understand for a non-programmer! Thank you!

This is where AI agents come in really handy.

If you had provided the legal database API I could easily check to see if make.com has an app for it which will make it a native integration and would enable a drag and drop setup.

How do you get the inputs into make.com? Via a web hook I suppose? Or are you using a form that has an instant trigger like a tally.so form? Regardless of input method your need something that instantly triggers the workflow.

And if I were you I would classify inputs. This is a legal issue and it’s crazy sensitive. Your AI might end up giving your client a horrible piece of advice not because the AI is bad or wrong but because the AI needs more than enough contexts to properly handle legal cases.


Another importance of the input classification is to triage your inputs in real time and be able to escalate some inputs to you for human legal oversight which is extremely vital here. You will also need succinct logging for governance audits to ensure you don’t allow your agent in a black box.


MY RECOMMENDATIONS:

Use a webhook to send your data to make.com then use an intake AI agent to triage and classify your inputs in real time. Give this triage agent about 10 to 20 legal themes that your practice specializes in. If the form inputs are categorized under any of these cases then the agent adds a marker that a filter around a router can understand and routes the input into a second AI agent. If the incoming data is about something not categorized under your 20 legal specialities then add a send email + Slack at the second end of the router and use that branch as a fallback in your filters.

With this, the agent can escalate the case to your team without wasting credits and tokens in cases where you hand the agent an email sending tool to use.

PLEASE LOG EVERYTHING. Add a database even a simple googlesheet at the end of every branch and map all important deatils to log every input.


Now your legal advice agent doesn’t get bombarded with almost every input because the intake agent only routes inputs classified under one of these themes. This means your agent stays deterministic.

This agent will have to do 2 big things. If you ask me I will say;

  1. Escalate inputs to you and your Slack team. - I’ll explain later.

  2. Draft the email and send to your customer/form filler/potential client.


  1. You said you have access to a legal database API that doesn’t automatically mean you’ll have answers that fits every single case. If your used case is high ticket advice then I recommend an API search done by the agent 2 times and use rules to determine whether the results resonate. If yes only then will it proceed with the advice and if the database response aren’t up to standards the agent escalates everything to your team or you.

This prevents high level hallucinations where the advice looks so correct even in the eyes of legal Pros but the case is actually wrong. Success here would depend on quality standards given to the AI agent to work with.


  1. Draft a legal advice and send.

Please if you want this agent to work on real legal cases don’t use a dry scanty email to send advices to your clients. Use a legal advice template and get the AI populate it so the format, presentation, structure and steps stays deterministic. This makes it 10x easier for the AI to work with.

Use an execution algorithm that details the steps that the AI will use to execute the advice, what tools to use, what knowledge rags to look at etc. This is to ensure you have consistent outputs. If possible give it an exemplary document to gain inspiration from.

I also would never recommend direct AI legal advises without HITL. You should please get the AI agent send the document for you or your team to review and then if you think adjustments are needed you do it. Only confirmed documents are sent to the client as legal advice. This is cleaner and more professional. It requires more time for sure but keeps you out of legal troubles.


As general rules. Don’t forget to use error handlers in make and input validation at the level of the form. And if I were working on such high stakes automations I would re-validate inputs, I will use modules like swndpulse email validation to ensure emails are valid so that addresses that fail validation are logged immediately and the workflow is stopped instead of working all through just to send an email that never gets recievd and maybe can’t be adequately retrieved.


I can help you out.

Thanks for your input, Daraima. However, please note that my business workflow, the 4 categories, and the 100% automated layout are completely locked and in production. I do not need any high-level advice on triage, Slack, manual oversight, or human review. Let’s keep it strictly technical.

My exact blueprint is a single OpenAI Specialist module using the newer o4-mini model, and I want the AI itself to intelligently decide when to search the legal database API during its single execution.

To achieve this setup using OpenAI Function Calling (Tools), please answer these two questions directly:

  1. Do I need to add any other modules next to the OpenAI module to handle the API search? Or can the advanced OpenAI Chat Completion module handle the HTTP request directly inside its own native “Tools” configuration?
  2. If yes, what is the absolute simplest module configuration? Do I just connect a standard Make “HTTP - Make a request” module directly to the OpenAI advanced module to execute the API call when the AI triggers the tool?

Please give me the raw, technical Make.com answer with no fluff. Thanks!


Oh alright Martin thanks for that clarification. I get you now. I understand you might not need to alter your workflow much or expose your business logic.

What you’re trying to do sadly can’t be done with just a single AI module like “get a response” module. And you’ll obviously need some smart filters and routing especially if not every input requires a database search. But first let’swork on a scenario where every input requires a database search. The first AI module will still need to understand the query and plan on the database search. You can get it understand that the API legal search module is right behind it. If the legal database isn’t native to make then you can use an API call module or a http module to fetch the legal data.

Once the legal data is fetched you map it as part of the input into the next AI module that uses the form input plus the fetched legal data to draft a legal advice email. I strongly recommend you get the email drafting agent to output a json. This is because you can parse and map the json into the recipient_name, email ID, Email Headline, and email_body. But a single bunch of generated text that AI typically produces can only be mapped completely into one field.

At the end of the workflow you use your preferred email module to send an email. Map the recipient email from the form data into the recipients’ email ID. And then add the email Headline from the json, as well as the email body from the same json.

So from form input module (maybe webhook) → AI module (to decide on what and how to search the legal database)–> database search module (a make native module if present or a http module if you’re absolutely certain about your AI agent’s output and the consistency of your legal database search) → the second AI module that drafts the legal email from the legal data and user data (should produce and parse a json so that you can map it directly into the email sender.) → Lastly the email module (send an email that takes the recipient info and sends them the legal advice Email).

This should work. Give it a shot. Just be extra vigilant with fetching the data from the legal database correctly. Http modules can run perfectly and still fetch no data. Plus your second AI module will still use the empty http module output, draft a hallucinated email and fire it to your client. So test the http module that fetches the legal database data rigorously.

In case not every input requires a database search just give me a signal and I will give you solid suggestions on how to use filters and a router to run the second branch that drafts an email without legal input data or performs another preferred action of your choice.

Good luck. :folded_hands: