How to use Formaloo SDK
Formaloo SDK is a Python-based SDK to be used in the development of apps and...
Formaloo SDK is a Python-based SDK to be used in the development of apps and scripts based on the power of Formaloo’s features. The primary purpose of the SDK is to provide an easy-to-use Python environment enabling developers to authenticate a user and use APIs of the Formaloo Customer Data Platform (CDP) and Formaloo database builder.
What can Formaloo Platform for me and my business?Formaloo is the next generation of data analytics. With Formaloo you can use your own data to analyze your customers, your business and even predict the future. Formaloo adds an AI-powered data expert to SMBs & SMEs so they can really understand their business and their customers and act on it to boost their Loyalty, LTV and CX.
Formaloo is built for businesses, not data scientists. It’s super simple to use and understand, you don’t have to know data analytics or coding and best of all, it requires no data experts to operate it.
Formaloo CDP is a Customer Data Platform that collects, analyzes, and unifies data from all data sources in order to grow customers’ loyalty.
Formaloo is a business productivity solution built to transform the way people collect information and put it to work. Formaloo solutions such as Formaloo CDP, Data Collection (Database & Form builder), Formaloo DataFlow, Data Analysis tool, Workflow Automation help thousands of businesses every day to collect & manage their data with impact.
Note: even though you don’t need to write any code for using Formaloo, but we have made it possible for you to create your own apps and use the Formaloo APIs as you like by creating Formaloo SDK.
How to use Formaloo SDK?● First Step: InstallationInstall formaloo SDK using pip:
pip install formaloo-cdp
● Second Step: AuthenticationIt will be necessary to have created a Formaloo account with a Connection and have the client_key and client_secret codes for the Connection to use the SDK.
Get client key and secret key in formaloo dashboard:Go to the link below and click on Add Source button to create a new connection.
Formaloo CDP (Beta)Web site created using create-react-appcdp.formaloo.net
Then click on your connection and you will see this page:
Formaloo CDP
Then export them as environment variables:
export FORMALOO_CLIENT_KEY = 'YOUR_FORMALOO_CLIENT_KEY'
export FORMALOO_CLIENT_SECRET = 'YOUR_FORMALOO_CLIENT_SECRET'
Also, you can create a .env file and add these variables to it.
Simple Usage ExampleFor example we want to get the list of our forms, first, we should import Form class and create an instance, then we call get_list method like below:
from formaloo.forms import Form
form = Form()
form.get_list()
action: Every class has a list of actions. in this example, get_list is an action of Form class. You have access to the list of actions for a class by actions_list property. print(form.actions_list)
A simple scenarioWe want to use Formaloo SDK to create a form in our app that has a field, then we submit the form with our data. then we get the list of rows(submits) for our form.
● First, we create a form
We create a form and keep slug and address of it.
from formaloo.forms import Form
form = Form( title="my simple form")form.create()form_slug = form.slugform_address = form.address
● Adding fields for the form
Add first name and last name fields to the form using slug of form and short_text
field type.
Add first name and last name fields to the form using slug of form and short_text field type.
from formaloo.forms import
first_name_field = Field( type='short_text', form=form_slug, title="Your first name")first_name_field.create()first_name_field_slug = first_name_field.slug
last_name_field = Field( type='short_text', form=form_slug, title="Your last name")last_name_field.create()last_name_field_slug = last_name_field.slug
Now we have our form with two fields:
See your form using form_address variable that you set:
Open this URL: https://formaloo.net/form_address
● Submitting the form
Submit the form and then you can see responses of the form in formaloo’s dashboard.
from formaloo.forms import FormDisplay
submit_data = { first_name_field_slug: "John", last_name_field_slug: "Doe"}
form_display = FormDisplay( **submit_data)form_display.submit(url_params=[form_slug])
url_params: in this argument, we set parameters of URL in a list by order.
Open https://dash.formaloo.net/u?page=1 and select your form then you can see that the response(row) added for your form:
● Getting the list of rows for the form
Then we can get the list of submits (Rows) for the form using SDK:
rows_list = form.rows_list( url_params=[form_slug])print(rows_list)