In a previous post, I explained how to configure ChatGPT with Azure Logic Apps. At the time, my team and I created that article mainly for fun. We did not yet have a clear idea of how to apply it to real-world integration scenarios or to support integration projects.
📝 One-Minute Brief
Validating messages does not always require complex JSON schemas. This article shows how to use Azure Logic Apps and ChatGPT to validate messages using natural‑language rules, enabling more flexible and readable validation logic for integration scenarios.
During a break at the INTEGRATE 2023 conference, Mike Stephenson showed me an idea he had while listening to a talk on using ChatGPT to perform transformations using natural language, thereby replacing the maps. Needless to say, it was a fascinating and fun conversation. You can see his blog post here:
That discussion made me think about other ways to use ChatGPT in integration projects. I explored several ideas, but one stood out immediately. It aligned closely with Mike’s concept: message validation.
In this approach, a Logic App processes the data. ChatGPT then validates the message by interpreting natural-language validation rules.
So I ended up creating this small sample scenario where we have the following JSON Message:
{
"Company": "SP",
"Operation": "Insert",
"Request": {
"OrderID": 2,
"ClientName": "Sandro Pereira",
"ShippingAddress": "Pedroso, Portugal",
"TaxId": 111222111,
"ProductName": "Chocollate Bar",
"Quantity": 1
}
}
And we want to validate the incoming message if it is valid or not based on the following rules:
- The OrderID must exist and be an Integer.
- The ClientName can not be empty or null.
- The Quantity must exist, and it is an Integer.
- The value of the Company field can only be “SP” or “LZ”.
- The Operation field must exist.
You can, of course, validate messages by defining a JSON schema with all the required rules and validating the payload against it. However, Logic Apps do not natively support some of these rules, such as regular expressions or complex patterns.
The main goal of this post is to simplify that process. Instead of relying on schemas, it shows how to use natural language to describe and enforce validation rules.
You can watch my coworker Luís Rigueira describing the process in this video:
So how do we achieve this?
First, as you already know, you should create a Logic App. It can be Consumption or Standard. We will be using Consumption, and then you should give it a proper name because starting using proper names from day one, the rule never gets old!
And then create a Logic App that has the following structure:
- When a HTTP request is received trigger.
- A Compose action.
- An HTTP action.
- And finally, a Response action.

Leave the When a HTTP request is received trigger as his. And on the Compose action, add the following configurations with all the actions to apply the validation of the message:
Check if the Json Input is valid or invalid by these rules:
The OrderID must exist and be an Integer
The client name can not be empty or null
The Quantity must exist and it is an Integer
Company can only be "SP" or "LZ"
Operation must exist
If it is valid return a message saying "body is valid"
If it is invalid return a message saying the "body is invalid" and explain why.
Json input: @{triggerBody()}

As the JSON input, we dynamically select the Body property from the Trigger, which contains the JSON we send via Postman.
Next, on the HTTP call, we need to perform the call to the ChatGPT API to perform or try to perform the JSON message validation. To do that, we need to specify the following body:
{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "@{outputs('Compose_-_Instructions_to_be_followed')}",
}
]
}

If you want to know or understand a little bit about this – How to call ChatGPT from a Logic App – see my previous blog post: Using Logic Apps to interact with ChatGPT.
Finally, we need to configure the Response action to use the following expression in the response:
trim(outputs('HTTP_-_Call_Chat_Gpt_API')?['body']?['choices']?[0]?['message']?['content'])

This way, we only send the message content as a response. Now, if you test your logic app with Postman, this should be the result:

If the rules we added to the Compose action are met, we will get the following response:
- The body will be valid.
Otherwise, the body is invalid, and ChatGPT explains why.
Of course, I think at this stage, maybe AI is still not a reliable option to be used in data transformation or data validation, but it shows potential.
Once again, thank my team member, Luis Rigueira, for helping me with these always crazy scenarios.
Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego!