Adding AI to your automation
You know Zapier, n8n and webhooks. Now you connect them to a language model without writing a line of code. The step that turns automation into real AI automation.
Up to here in level 3 you have learned what automation is, how Zapier and n8n work and how webhooks send data from A to B. What has been missing is the bridge. All those flows move data and follow fixed rules. If this, then that. But as soon as the task needs a bit of understanding, sorting an email, summarising a text, turning a wild form into clean fields, pure if-then logic hits its limit. That is exactly where you put a language model into the middle of your flow. That is the step that turns automation into AI automation, and you need no code for it.
Picture a typical case. Contact requests land with you through a form. Some are genuine customer enquiries, some are spam, some are job applications. A classic automation cannot tell them apart, because the difference sits in the text and not in a fixed field. A language model can. You send the text of the request to the model, ask "is this a customer enquiry, spam or a job application, answer with one word only", and route accordingly. That is the idea in one sentence.
Where the model sits in the flow
In every no-code platform the structure is the same. You have a trigger, then several steps, an action at the end. The language model is simply one of those steps in the middle. Before it comes the trigger, the form entry. After it comes the action, the email or the database entry. The model sits in between and turns unstructured input into a decision or a clean output.
There are two ways to address the model. The convenient way is a ready-made building block. n8n has an AI node, Zapier has an AI integration, and both let you pick a provider directly, type in a prompt and use the result in the next step. The flexible way is the HTTP request node you already know from the webhook lesson. With it you call the provider's API directly. That is exactly the same principle as a webhook, only that the recipient is a language model.
The direct API call
If you take the HTTP route, you build a perfectly ordinary POST request. With the Anthropic Messages API it goes like this. You need three headers and a body.
POST https://api.anthropic.com/v1/messages
Header:
x-api-key: YOUR_API_KEY
anthropic-version: 2023-06-01
content-type: application/json
The anthropic-version header is fixed and stays 2023-06-01, that is the API version and has nothing to do with today's date. You get the x-api-key from your provider account. Treat it like a password, it never belongs in a public form or a shared flow.
Minimally the body looks like this:
{
"model": "claude-haiku-4-5",
"max_tokens": 200,
"messages": [
{
"role": "user",
"content": "Sort this request into exactly one category: customer enquiry, spam or job application. Answer with the category word only. Request: {{form_text}}"
}
]
}
The {{form_text}} is a placeholder the no-code platform fills with the real content from the previous step. In n8n you write that as an expression, in Zapier you drag the field in by clicking. The model's answer then sits in a field you use in the next step, for example to decide via a filter whether the email goes to sales or into the spam folder.
A word on model choice, it saves you real money. For simple classification and reformatting take the cheapest model, so Haiku 4.5. It is fast and costs almost nothing per call. For tasks that need genuine understanding, such as summarising a request in your own words, take Sonnet 5. In an automation flow you almost never need Opus, that would be a sledgehammer to crack a nut.
Structured answers instead of prose
The most common beginner mistake is letting the model answer freely and then hoping the format fits. Sometimes it answers "This is a customer enquiry", sometimes "Category: customer enquiry", sometimes with a whole paragraph. Your automation cannot do anything with that because the next step expects an exact word.
The solution is to tell the model in the prompt exactly what the answer should look like. "Answer with the category word only, no sentence, no full stop." It gets cleaner still when you demand JSON:
{
"model": "claude-haiku-4-5",
"max_tokens": 300,
"messages": [
{
"role": "user",
"content": "Extract name, email and request from this text. Answer exclusively as JSON with the fields name, email, request. Text: {{form_text}}"
}
]
}
JSON is so practical because most no-code tools can split it directly into individual fields. The model output {"name": "Anna", "email": "anna@...", "request": "quote"} becomes three clean fields you use separately. With that you have turned a chaotic free-text form into structured data, and that was impossible before with pure if-then logic.
What can go wrong
Three traps from practice.
First, the model does not always stick to the format. Even with a clear instruction, an extra sentence occasionally comes along. Build in a safety step that checks whether the answer really is one of your expected words, and send everything else into a manual review instead of processing it blindly.
Second, costs creeping up unnoticed. A flow that calls a model on every form request is cheap. A flow that runs in a loop and calls the model a thousand times can surprise you. Look at the usage in your provider account after the first day, before you switch the flow live.
Third, the API key in the wrong field. I have seen flows where the key accidentally landed in an output field that later showed up in an email. The key belongs in the platform's credential management, never in the prompt text and never in a field that goes outwards.
What next
You can now put a language model as a step in the middle of your automation, either via a ready-made AI node or a direct HTTP call, and you know how to get clean structured answers. That is the foundation for almost every useful AI flow. In the next lesson, the level 3 capstone, you build a complete flow from trigger to action with a model in the middle. If you want to let the HTTP part settle again, reread the webhook lesson in this level, the principle is identical.
Source
- Messages API reference: https://platform.claude.com/docs/en/api/messages
- Models and pricing: https://platform.claude.com/docs/en/about-claude/models/overview