Configure an email connector
Bonita provides connectors for a process to interact with external systems, such as publishing a document on a CMS, calling a REST API, or sending an email. In this example we will configure an email connector, to send a notification to the manager that the task Deal with unsatisfied customer requires their attention.
A connector is a piece of code that is executed when starting or finishing a process or a task. It will process input data (for example business variable values) and can also generate outputs. The connector code might only transform inputs, but it can also perform interaction with external systems. |
To avoid settings that are specific to a real email provider, use a tool for a fake email server "FakeSMTP":
-
Download FakeSMTP from this https://nilhcem.github.io/FakeSMTP/downloads/fakeSMTP-latest.zip
-
Unzip the file
-
Run FakeSMTP by double-clicking on the JAR file, or by running this shell command:
java -jar fakeSMTP-2.0.jar
-
When the user interface is displayed, set the listening port to 2525
-
Click on Start server
Now that you have a fake email server running, configure the email connector on the Deal with unsatisfied customer task:
-
Select the task Deal with unsatisfied customer
-
Go to
-
Click on Add…
-
Select the Email (SMTP) connector
-
Click on Next
-
Name the connector configuration Send notification
-
Click on Next
-
Set the following parameter values:
-
SMTP host: localhost
-
SMTP port: 2525 (the port number specified in FakeSMTP)
-
SSL (in the Security section): unchecked
-
-
Click on Next
-
Enter
no-reply@acme.com
in the From field -
Use the icon to edit the expression of the To field
-
Set the Expression type to Script
-
Paste the following Groovy script into the code editing zone:
apiAccessor.getIdentityAPI().getUserContactData(taskAssigneeId, false).email
-
Click on OK
-
Click on Next
-
Set You have a pending task as the subject
-
Click on Finish
Run the process with the connector configured, and see a new incoming email in the FakeSMTP user interface when task Deal with unsatisfied customer becomes available.
You have now a process definition that uses a wide range of Bonita features. In the next chapters, we will create an application on top of this process.