Introduction
Up to this point your app can talk to its own database, but it cannot think or fetch outside information. In this lesson you connect two missing pieces: an AI model (for generating answers, summaries, or classifications) and an external API (for live data like weather, currency rates, or stock prices). Both connections follow the same pattern — send a request, wait for a response, handle the result — so once you understand one, the other is just a different address and a different shape of data.
How AI Model Calls Work
An AI model call is just a text-in, text-out request. You package the user's question (and any system instructions) into a JSON payload, POST it to the model's endpoint, and read back the generated text. No-code tools wrap this in a visual block, but underneath the wire format is identical.
A typical request body looks like this:
The `system` message sets behavior; the `user` message is the actual input. `temperature` controls how creative versus deterministic the output is — low for factual tasks, high for brainstorming.
How External API Calls Work
External APIs (weather, currency, news) work the same way, but the payload is usually simpler — a few query parameters instead of a conversation history. For example, a weather lookup might just need a city name and an API key.
The response comes back as JSON. Your no-code tool lets you pick which fields to extract and where to store them in your database or UI.
Handling Inputs, Outputs, and Errors
Three things go wrong in almost every integration: missing fields, slow responses, and unexpected response shapes.
First, validate inputs before sending. If the user did not provide a city name, do not call the weather API — show a friendly prompt instead.
Second, set timeouts. Most no-code platforms let you set a max wait time (8–15 seconds is reasonable). If the AI or API does not respond in time, show a fallback message rather than letting the screen hang.
Third, guard against malformed responses. AI models occasionally return empty strings or refuse to answer; APIs sometimes return error objects in a 200 response.
A common pattern is to wrap every external call in a try/catch (or the no-code equivalent: an error branch on the workflow node) and log the failure for yourself while showing a polite message to the user.
Summary
AI model calls and external API calls share the same skeleton: validate input, send a structured request, parse the response, and handle failure gracefully. In your no-code workflow, each step is a visual block, but the logic is the same as the code snippets above. Get comfortable with this request-response-error pattern, because every integration you build from here on out will follow it.
In the next lesson you will combine multiple API calls into a single workflow so your app can, for example, fetch the weather, pass it to an AI model, and return a travel recommendation — three integrations chained together.
Lesson Checkpoint
Review what you learned and get feedback on your work.