How I Built an FAQ Chatbot with ChatGPT in OutSystems
By Pedro Cadete
Over the past few months, I’ve been diving into the exciting intersection between low-code development and artificial intelligence. One of the most practical and impactful applications I’ve explored? Building an AI-powered chatbot. I’m not talking about those old-school, generic bots that give you robotic answers, repeat questions, or give you vague answers. I’m talking about smart assistants trained on your company’s internal knowledge — ready to deliver fast, accurate, and contextual responses to your team, customers, or anyone who needs help.
As companies grow and our knowledge spreads, sometimes it feels like we need a little help to get the right answer. We all know how frustrating it can be to dig through documentation or wait hours for an email reply. People expect real-time support, and a smart chatbot embedded where work happens can be a total game changer.
As Paulo Rosado , the CEO of OutSystems , once said:
digital transformation starts with practical solutions.
These new-generation chatbots are exactly that: fast to build, easy to integrate, and can make a real impact.
So, here’s how I built an FAQ chatbot using ChatGPT inside the OutSystems platform. In this article, I'll share how I built a chatbot using ChatGPT inside the OutSystems platform and why I believe this approach is a game-changer for companies looking to combine automation, intelligence, and speed.
Let's start building our chatbot together!
Step 1: Setting Up the ChatGPT API
First things first, you need access to the OpenAI API. Here's how to set that up:
Open AI API Reference: Let’s create our Chat GPT API Key.
Go to: https://platform.openai.com/docs/api-reference/introduction
Create an account and complete your profile
Generate your API Key.
Save your API KEY!! (this will never be displayed again) – my api key example below!
The "completions URL" is below. You can use it to test your API key.
This API JSON works like this:
model – it is the ChatGPT model, in this case, the model mini is the one set on the image above.
messages – holds a list of messages to send to ChatGPT.
Step 2: Integrating the API in OutSystems
In OutSystems, in Logic tab and under Integrations folder, create a REST one single method. Insert the Completions URL and add an Authorization request header to hold your API Key, but before, add Bearer (see image below).
Create the body in the Request section:
You might be wondering how we have two roles: system and user. I asked the same question during the walkthrough of the documentation.
So, the user is the "entity" sending the message. In other words, it's the customer in the app. The "system" refers to our app, which is the heart of our business idea.
In the example shown above, the user is sending "How to recover my password?". And the system is sending: "To recover the password go to login page and select forget password".
IT'S OK! The chat GPT doesn't know any business concepts about us or what we're about. By sending content as a system, we can provide him with the context he needs to respond to the customer's inquiry.
Step 3: Creating an FAQ Table
You're probably wondering, where is the data stored, or how do we know which content to send based on the customer message?
We can do this together! All we need to do is save this data on an entity like this one:
This will help our bot understand what it needs to return to the customer.
Remember, this is an FAQ bot. We expect businesses to have questions and answers to quickly help customers instead of having to read long documents.
Step 4: Creating the chat message
To display the conversation, I used the Chat Message widget.
Once you've created the chat message on the front end, please send it to the ChatGPT integration. Also, send the answer from your FAQ answers table. This will allow ChatGPT to respond accurately to the customer. But first, which answers should we send to ChatGPT? 🤔
Alright, let's move on to step five! Here's what we're going to do: we're going to chat with Chat GPT and let it know what kind of data we want it to take care of for us.
Step 5: What data should we send to ChatGPT, and how should we send it?
When deciding the data to send, in this case, the answers, we should compare the text that the user sends and match it with the questions that we have in our FAQ table and send the associated answer. Make sense?
One way to fetch the answers based on what the customer asks is by using the following query:SQL Query:
Here is a breakdown of what it does:
Select
Selects FAQ question and answer fields
From
The table to get the data
EXISTS (...)
Returns true if the inner query finds any matching word — meaning the question is relevant to the user message.
LOWER(@UserMessage)
Converts the user message to lowercase for case-insensitive comparison.
string_to_array(..., ' ')
Splits the message into individual words using space as the separator.
unnest(...) AS word
Turns the array of words into a set of rows (one word per row).
(CAST({BusinessFAQ}.[Question] AS text) COLLATE "C")
Applies the "C" collation for case- and accent-sensitive matching
LIKE '%' || word || '%'
Checks if each word appears anywhere within the FAQ question (substring match).
So, by checking the SQL you masked, That SQL code retrieves many answers from the table?!
And yes, it does!
I applied like this because I want to make sure that we get answers even if it is not directly related to the user message. By doing this, we can also improve the ChatGPT answer by retrieving better responses.
The responses we get, we wrap them and send them to the ChatGPT message as Role System.
DO NOT FORGET!!
Before running the SQL query, make sure that you call Chat GPT when the customer sends something meaningful, for this, we set an if.
If the customer message length is less than 3 characters, the query and the call to ChatGPT are not made.
If this happens, make sure to send a message by default, like: “Sorry, do not understand what you mean”
Step 6: Chatbot Preview:
Send message
Chat Bot Answer
As we can see, the user sends the message: I am having problems to recover my password, can you help me?
ChatGPT sends a very detailed answer. Step-by-step explanation, and also the email and phone number to get in contact with the business.
Final Thoughts
This project showed me how easy it is to unlock powerful AI capabilities using OutSystems and ChatGPT. Whether you’re building internal tools or customer-facing apps, adding a conversational layer transforms how people interact with your solutions.
The best part? It doesn’t take months. You can go from idea to prototype in days. So, are you ready to build your own? Start small. Stay curious. And let AI do the heavy lifting. Let's make ECHO
Certified OutSystems Developer | Building Scalable Solutions at KPMG | Open to Industry-Spanning Projects
2moAfter carefully reading the post i came to the point that yes, the heading is very useful and good for learnign purpose. But the things which you posted in it is not up to the mark. May be you don't want to write more, or you want your learners or starters leave the post without completing it as it have plenty of information not available on this post. If anyone wants only to know that integration ChatGpt with your low code platform is available then its okay. But how to do that that has nothing to do in this post.
Digital Marketing & Strategy Manager
2moSuch a great read, Pedro! 👏 Clear, insightful, and super relevant for anyone exploring the power of AI in low-code development. Proud to have brilliant minds like yours sharing knowledge and driving innovation at Ruption.