Creating event-driven flows from scratch

In an event-driven flow, you identify an event in a source application that triggers a flow to complete actions in one or more target applications.

Before you begin

If you know which applications you want to interact with, open the Applications and APIs page and create accounts for the connectors that process events from a source application and complete actions against the target applications. Alternatively, you can create accounts when you create a flow. For more information, see Connecting to accounts.

About this task

To create an event-driven flow, you first specify the event that triggers the flow. The event might be something that happens in an application, or you might decide to start the flow on a schedule. You then add actions to be completed in one or more target applications. You can also add toolbox utilities to process the input or output data from the applications in your flow. The following restrictions and behaviors apply to event-driven flows.
  • You can add a maximum of 10 actions to a flow.
  • Actions are completed in the order that is shown in the flow.
  • If one of the actions fails, the following actions in the flow are not completed, but previous actions are not reversed.

Procedure

To create an event-driven flow, complete the following steps.

  1. On the App Connect Designer home page, click Create an event-driven flow.
    Alternatively, from the Design page Design page icon, click Create > Event-driven flow.
    The flow editor opens.
  2. Enter a name that identifies the purpose of your flow.
    Screenshot that shows the name of the flow on the header of the editor
    Tip: If you're on the flow runs plan, the flow name can contain a maximum of 32 characters. When you deploy a flow on the flow runs plan, the deployment takes the name of the flow, and a deployment name can contain a maximum of 32 characters.

    As you progress with the flow, App Connect automatically saves your changes. If you navigate away from the flow, the flow is saved as a draft flow that you can complete at another time.

  3. Add an event to trigger the flow.
    You can choose to receive streamed events from a source application, poll an application for events, or configure a schedule for events from an application. If you don't see a connector on the Applications and APIs page for the event that you want to add, try searching for a community connector in the IBM Automation Explorer. You can also create a connector by using the Connector Developer Kit. For more information, see Adding or creating community connectors.
    • To stream events from a source application, click an application on the Applications and APIs tab, then click the object and event type that you want to stream events for. For example, to send event notifications to App Connect whenever an attendee signs up to an event in Eventbrite, click Eventbrite, then Attendees and New attendee.
      Ensure that the correct account is selected in the Account list.
      Selecting an application and event type for streamed events
      The event node is added to the flow.
      Screenshot that shows the first node in an event-driven flow, which is a Salesforce new contact event

      Some applications use webhook callback URLs to send event notifications to your flow. For some applications, like Eventbrite, the callback URL is registered automatically with the application, while for others, you have to register the URL manually. For more information, see Webhook callback URLs.

    • To poll a source application for new or updated objects, click an application on the Applications and APIs tab, then click Configure more events. From the Select the event to configure panel, click the object that you want to monitor and click the type of event. For example, to trigger your flow every time a new account is created in Salesforce, click Salesforce > Configure more events, then click Accounts and New accounts.
      Selecting an application and event type for polled events
      The event node is added to the flow. Ensure that the correct account is selected in the Account list, then configure the polling intervals. For more information, see Configuring polled events to trigger flows.
      Event node for polled events
    • To configure your flow to run at regular intervals or at specific dates and times, open the Toolbox tab, then click Scheduler.
      Selecting the Scheduler from the Toolbox tab

      The Scheduler node is added to the flow. Define a schedule for the flow to run. For more information, see Configuring your flow to run at scheduled times.

      In this example, a schedule is defined to trigger the flow when it first starts, and then daily on an hourly basis.
      The configuration for a Scheduler node. The schedule type is set to "Repeating interval". The node is set to run every 1 hour and every day of the week is selected. The selected timezone is UTC. The "Also run the flow when it's first switched on" checkbox is selected.
  4. To add the first action to the flow, click Add node (+), then select an application and an appropriate action.
    Ensure that the correct account is selected for the target application. If no accounts are connected, you can add one. For more information, see Connecting to accounts. If you don't see a connector on the Applications and APIs page for the action that you want to add, try searching for a community connector in the IBM Automation Explorer. You can also create a connector by using the Connector Developer Kit. For more information, see Adding or creating community connectors.
  5. Populate the fields of the action with values that you want to pass to the target application. You can specify static data in plain text, or you can specify dynamic data by adding mappings from previous nodes in the flow. You can also apply functions (JSONata expressions) to transform your data, or use other built-in mechanisms to define custom values.

    You can use sample data to test your mappings as you add them. For more information, see Testing mappings with sample data.

    In the following example, a Salesforce Retrieve leads action is used to retrieve details of new leads that are created in Salesforce since the flow was last triggered. To define this behavior, click Add condition and select Created date and is greater than from the first two fields. Then click in the third field and click Insert a mapping Insert a mapping icon to open the Available mappings list. From the list, select Previous event time, which represents the time when the previous schedule was triggered. You can also configure the maximum number of items to retrieve, and error conditions.
    Populated fields for an action
    Tip: After you complete the fields for the action, you can use auto-generated or custom sample data to test the action and verify its effect. Ensure that you use a non-production account to test the action because the action is completed on the target application that you're connected to. For more information, see Testing actions with sample data.
  6. Optional: Add more target applications and actions.
  7. Optional: Use one or more toolbox utilities to provide specialized processing.
    For example, add an If node to provide conditional processing, or a For each node to process retrieved items. For more information, see Adding special processing to a flow (Toolbox utilities).
    In this example, a For each node is used to loop through the retrieved Salesforce records and create corresponding lead records in Insightly. Click the (+), go to the Toolbox tab, then click For each to select the collection of items to process and processing options.
    For each node settings
    Next, click Add node (+) in the For each node, and from the Applications tab, click Insightly > Leads > Create leads. Click Insert a mapping Insert a mapping icon to populate individual fields with mappings that represent the processed output from the Salesforce node.
    Smart mapping suggestions generated by Mapping Assist
    Click View suggestions to switch to inline preview mode, which inserts a preview of the suggested mappings into the matching fields. Examine the preview mappings to verify that they are suitable for your requirements and then click Apply 15 suggestions to populate the fields.
    Fields populated with smart suggestions
  8. Optional: You can add an error catch flow to handle errors in your event-driven flow.
  9. Before you test or deploy your flow, fix any validation errors in the flow.
    For more information, see Validating your flow.

Results

Your flow is displayed as a tile on the Design page. You can use the tile to manage your flow. The options that are available for managing your flows depend on your plan, the type of flow, and its status. For more information, see Managing flows during development.

What to do next

  • You can test the behavior of your flow before you deploy it. Depending on your plan, you can either test with sample or real data. For more information, see Testing flows during development.
  • When you're ready to run your flow in a production environment, deploy it. For more information, see Deploying integrations.