ProcessMaker.IO Onboarding Examples
This repository contains a collection of examples in using the ProcessMaker.IO workflow engine. This collection utilizes the PHP SDK and is referenced in the ProcessMaker.IO Blog to demonstrate various concepts of the workflow engine.
Create a .env file to store your configuration for your ProcessMaker.IO instance and the access token for the user you wish to use the API with. It will also contain configuration for some of the examples. An example .env file would look something like this
Then run composer to install the dependencies. This will pull down a couple utility libraries as well as the ProcessMaker.IO PHP SDK.
There is a tools directory that helps you with getting information about your workflow engine and clearing the processes. The files are:
- Deletes all processes from your engine
- Retrieves process instances and their tokens for a given process id
Each example is stored in it's own directory. There is a script to create a process as well as any other relevant files such as example HTML forms. The examples are:
This example shows you the most basic way to create a new process programatically. It also shows how to start a process by calling a Start Event's webhook and populating a webhook. The process sends an email via a SendMailConnector and the email contains information submitted by a contact form written in HTML.
This example introduces:
- Start and End Events
- Service Tasks
- The SendMailConnector connector
- Sequential flows
Creating the Introductory Process
You'll need to call the API to programatically create your process. You can do this by:
You should receive the newly created Process ID, as well as the Start Event ID. These are used in the next step as part of the webhook url to call.
$ php ./introduction/create.php Process ID: b78fc897-91f8-4f38-b8e3-7d60267d9b67 Start Event ID: 271bf2f1-47bb-4616-9edb-3892b5696710
Modifying the HTML Form
You should modify the form.html. You'll see a spot where you can update the pmio_webhook variable. The URL should contain the process ID and the start event ID you gathered when creating the process.
<script> var pmio_webook = 'https://fds23zz.api.processmaker.io/api/v1/processes/b78fc897-91f8-4f38-b8e3-7d60267d9b67/events/271bf2f1-47bb-4616-9edb-3892b5696710/webhook'; </script>
Executing the Form
Load the form in your browser. Fill out the form. If the form is submitted properly, you should receive an email with the form details.
More Examples Are Coming!
Keep an eye out on this repository as it is updated with new examples that introduce additional ProcessMaker.IO concepts!