How To Guide - External Form Integration
Overview
An external-form task assigns work inside an existing workflow and opens a page hosted by your application. The application submits the business data and completes the assigned task through the AI Command Center API. It can also start a workflow through a separate API call, as this example demonstrates.
How the example works
The downloadable Flask application's submit_leave handler starts the External_LeaveApproval workflow and stores its process instance identifier with the leave request. The approval page is identified by the request's leave ID.
When the reviewer submits an approval, finalapproval retrieves the assigned task, calls updateModelData to submit the approval status, and calls completetask to complete that task. The helper functions are in ibapi.py:
| Helper | API operation |
|---|---|
create_processinstance | Starts the workflow with input arguments. |
gettaskid | Retrieves tasks associated with the stored process instance. |
updateModelData | Submits Approvers.HRManager.Status to the workflow. |
completetask | Completes the assigned task as the reviewer. |
Starting the workflow and completing its task are distinct operations. Submitting an HTML form alone does not complete the workflow task.
This is a local demonstration. Configure your own API endpoint and test credentials before running it. Startup initializes the sample database and attempts to create the demonstration user and enterprise variable; use a test environment. The callback URL must be reachable from the reviewer's browser.
Creating and executing a sample application with detailed step-by-step instructions
Here are the step-by-step instructions with an example explaining how to integrate an external form into the IntelliBuddies AI Command Center:
Let's create Leave Application Management using Python and link it to the IntelliBuddies AI Command Center for execution.
Instructions to run a sample application
To use the application, you first need to download it. Then, set it up on your device and run it.
-
Install Python 3.10 and above:
- Download and install Python from the official website: Python Downloads.
- Check the option to add Python to your system PATH during installation.
-
Open source code:
Download Leave Application Example
- Extract the above-downloaded source code and put it in a folder.
- Open source code in VS code or any other editor you choose.
-
Open a command prompt terminal:
- Open a terminal in VS Code or use your system's command prompt.
-
Run the following commands:
-
Use the following commands to install Flask for web applications.
pip install flask -
Install the Requests library in Python to perform HTTP operations such as GET, POST, PUT, DELETE, and others.
pip install requests
-
5. Update baseurl, username, and password fields in the ibapi.py file:
-
Locate the ibapi.py file in your source code.
-
Update the baseurl, username, and password fields in the following section of the ibapi.py file.
# Define your authorization server's endpoint and credentials
baseurl = 'http://localhost/api'
authurl =baseurl+'/auth/login'
headers = {'Content-Type': 'application/json; charset=utf-8'}
username = 'Username'
password = 'password' -
Below is the screenshot displaying the list of users added to the Leave Application Example you downloaded earlier. You can use these credentials to log in and apply for leave through the external form interface.

- Utilize the provided BPA process example:
Download Example BPA Process
- Follow the instructions provided to Upload the BPA process to your AI Command Center.
- Run the Flask application:
-
Start the Flask application.
python -m flask run -
Creates Enterprise Variable and User inside your AI Command Center
- Users:
**Log on Creation**
A user with the username 'hrmanager' is created in the AI Command Center.- Enterprise variables:
**Log on Creation**
An Enterprise Variable named 'LeaveMgntAppApprovalUrl' was created successfully in the AI Command Center.
- Access the application using the URL given in the terminal:
- Visit the specified URL (e.g., http://127.0.0.1:5000/) in your web browser to access the application.