I'm trying to use the OpenAI integration in n8n to extract specific information from a client's message and return it in a structured JSON format.
For example, I want the assistant to extract values like the client's name and city and return a response like this:
{
"output": "Hi! How would you like to be called? 😊",
"custom_fields_values": [
{
"field_name": "City",
"values": [{ "value": "Curitiba" }]
},
{
"field_name": "Name",
"values": [{ "value": "Ana" }]
}
]
}
What should I include in the prompt, and how should I configure the OpenAI node in n8n to make sure the response always follows this JSON structure?
Any tips for making the output reliable and machine-readable?