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":

  1. Download FakeSMTP from this https://nilhcem.github.io/FakeSMTP/downloads/fakeSMTP-latest.zip

  2. Unzip the file

  3. Run FakeSMTP by double-clicking on the JAR file, or by running this shell command: java -jar fakeSMTP-2.0.jar

  4. When the user interface is displayed, set the listening port to 2525

  5. Click on Start server

    FakeSMTP configured and listening

Now that you have a fake email server running, configure the email connector on the Deal with unsatisfied customer task:

  1. Select the task Deal with unsatisfied customer

  2. Go to Execution  Connectors in

  3. Click on Add…​

  4. Select the Email (SMTP) connector

  5. Click on Next

  6. Name the connector configuration Send notification

  7. Click on Next

  8. Set the following parameter values:

    • SMTP host: localhost

    • SMTP port: 2525 (the port number specified in FakeSMTP)

    • SSL (in the Security section): unchecked

  9. Click on Next

  10. Enter no-reply@acme.com in the From field

  11. Use the pencil icon icon to edit the expression of the To field

  12. Set the Expression type to Script

  13. Paste the following Groovy script into the code editing zone: apiAccessor.getIdentityAPI().getUserContactData(taskAssigneeId, false).email

  14. Click on OK

  15. Click on Next

  16. Set You have a pending task as the subject

  17. Click on Finish

    Email connector configuration

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.