Custom Actions | Chatbot API | body String

Hey! I am trying to use Custom Action to enable users to communicate with the Chatbot.
The Chatbot is AI-driven and gets trained to the context at a conversational level by receiving a string of text values (string is limited to 20). In other words, I need to send a few previous messages along with some user data from the database along with the current message from the text input in the chat.!

So I have a couple of questions:
How can I add inputs to the body as a String of Values? body = {‘context’, [str] }
Is it possible for Custom Action to pull data from the database and use it as inputs?

Attached couple of screenshots for better understanding