Article
make-aiautomationno-codeai-workflowopenaitext-summarizationapi-creationwebhooks
Build an AI Text Summarization API with Make
Use Make's visual builder to create an AI workflow. This guide shows how to connect a webhook to an OpenAI module, creating an on-demand API that accepts text and returns a concise summary. No coding required to build the workflow itself.
beginner15 min5 steps
The play
- Create a Webhook TriggerIn a new Make scenario, add the 'Webhooks' module and select 'Custom webhook'. Click 'Add' to create a new webhook and copy its unique URL. This URL is the endpoint that will receive the text you want to summarize. Make will 'listen' for data to be sent to this URL to help you map it in the next step.
- Add and Configure the OpenAI ModuleClick the '+' to add another module and select 'OpenAI'. If you haven't already, create a connection by providing your OpenAI API key. Choose the 'Create a Completion' action. For the prompt, select a model like 'gpt-3.5-turbo-instruct' and set the role to 'User'.
- Map Input Data to the AI PromptIn the 'Content' field of the OpenAI module, you'll define the prompt. First, type a static instruction like 'Summarize the following text in one sentence: '. Then, map the data from the webhook. If you send JSON like `{"text": "..."}`, you'll drag the `text` variable from the webhook panel into the Content field after your instruction.
- Return the AI-Generated SummaryAdd a final module: 'Webhook Response'. In the 'Body' field, map the output from the OpenAI module. The summary is typically located in the `choices[].text` variable. This configures the scenario to send the AI's summary back to whatever called your initial webhook URL, completing the API call.
- Test Your AI EndpointTurn your scenario 'ON'. Use the provided starter code in your terminal, replacing 'YOUR_MAKE_WEBHOOK_URL' with the URL you copied in Step 1. This will send a long text to your endpoint, and you should receive a short summary back as the response.
Starter code
curl -X POST YOUR_MAKE_WEBHOOK_URL \
-H "Content-Type: application/json" \
-d '{
"text": "Artificial intelligence is a broad field of computer science that deals with the creation of intelligent agents, which are systems that can reason, learn, and act autonomously. It encompasses machine learning and deep learning, which are subsets of AI that involve training models on large datasets to recognize patterns and make predictions without being explicitly programmed."
}'