Learn how to create a custom application from an Integration Bus application definition file so that every time a message flow processes a message, details of that message are sent in an email from your Gmail account.

IBM Integration Bus connectivity with IBM App Connect

The tutorial uses a pre-built sample application that’s designed to receive notifications from a Warehouse application. The sample application includes an Integration Bus message flow and an application definition file. For details of the sample application, and how you can use the sample application to help you to build your own message flow and application definition file, see iib-app-connect-trigger-pattern.

First, find or create everything you need:

  • One of the following IBM Integration Bus deployments:

    This is where we’ll deploy the Integration Bus message flow.

  • IBM App Connect subscription (Personal account).
  • (If you’re using Integration Bus Developer edition) Use your App Connect account to install and configure the IBM Secure Gateway Client and connect a private network. See Tutorial: Configuring a private network.
  • (If you haven’t already connected App Connect to your Gmail account) The OAuth client ID, client secret, access token, and refresh token for your Gmail account. For more information about how to get the required values, see How to use IBM App Connect with Gmail.
  • Some means to check and send messages to the Warehouse application (Integration Bus message flow). For example:
    • You can check the flow in your web browser, and can use a REST client to send messages to the Warehouse application.
    • You can use cURL commands.

Next, set up your message flow on IBM Integration Bus on Cloud:

  1. Download iib-app-connect-trigger-pattern-master.zip from GitHub and extract all the files into the C:\Warehouse directory.
  2. If you’re using Integration Bus on Cloud, complete the following steps:
    1. Log in to IBM Integration Bus on Cloud.
    2. Upload the BAR file that’s in the set of files that you downloaded: C:\Warehouse\iib-app-connect-trigger-pattern-master\WarehouseNewStockEventToAppConnect\Warehouse.bar.
    3. After you’ve uploaded the BAR file, click Save to prepare the integration. When prepared, the status of the Warehouse integration is shown as “Stopped”.
    4. Select the Warehouse integration from the Integrations page.
    5. Click Public Endpoints, make a note of the Service URL, for example: https://da3bnd1c.ibmintegrationbus.ibmcloud.com, and turn off Basic Authentication.


    6. Go back to the Integrations view, start the Warehouse application, and refresh the browser until the status is “Running”.
  3. If you’re using IBM Integration Bus Developer edition, complete the following steps:
    1. Start the IBM Integration Bus Toolkit.
    2. In the Integration Nodes pane, right-click the integration server, select Deploy, then click BAR from file system.
    3. Select C:\Warehouse\iib-app-connect-trigger-pattern-master\WarehouseNewStockEventToAppConnect\Warehouse.bar and click OK.

Your Integration Bus message flow is now running and waiting for notifications.

Then, configure your application definition file:

  1. In the root of the C:\Warehouse directory, make a copy of the following files from the C:\Warehouse\iib-app-connect-trigger-pattern-master\doc\ directory:
    • warehousedefinition.yaml: This is the application definition file.
    • purple_jumper.txt: This is some data that we’ll use to invoke the message flow.
  2. Edit C:\Warehouse\warehousedefinition.yaml:
    • If you’re using Integration Bus on Cloud, change host to the Integration Bus on Cloud Service URL (after https:// prefix) and schemes to https.


    • If you’re using Integration Bus Developer edition, change host to the Integration Bus host name and port; for example, localhost:7800.

      Note: If your IBM Integration Bus deployment uses SSL, change schemes to https.


The application definition file is now configured for your Integration Bus message flow.

Now, create your custom application in App Connect:

  1. Log in to App Connect.
  2. From the Applications tab on the Catalog page, click Add your application now.
  3. Add an Application name (for example, Warehouse) and a description (for example, Integration Bus Warehouse application).
  4. Make sure that the network is set appropriately:
    • If you’re using Integration Bus on Cloud, make sure that the network is set to None.
    • If you’re using Integration Bus Developer edition, make sure that the network is set to the private network that you configured.
  5. Browse to the warehousedefinition.yaml file that you edited, click Open, then Apply.

Your custom application is now displayed on the Applications tab, and can be selected as a first (source) application in a flow.

Then, create your flow:

  1. From the Dashboard, click New > Event-driven flow.
  2. Complete the following steps. If you navigate away from the flow at any stage, the flow is saved as a draft flow that you can complete at another time.
    1. Select Warehouse as your first application (source).
    2. Select newStock as the Warehouse trigger.
    3. Select Gmail as your second application (target).
    4. Select Create message as the Gmail action.
    5. If you haven’t already connected a Gmail account, click Connect to Gmail and provide the OAUth credentials to allow App Connect to connect to your Gmail account.
    6. Set up the Gmail action by completing the following fields.
      • To: Enter an email address (you can enter your own Gmail address or another email address to which you have access).
      • Subject: Type New stock in Warehouse.
      • Body: Populate the Body field by completing the following steps:
        1. Type New Stock: and then click the Insert a reference icon to show all the available source fields in the Warehouse application.
        2. Select id then type a hyphen.
        3. Repeat the previous step but select name, then color, and then size.


  3. Enter a name that identifies the purpose of your flow, for example: New Stock details. From the banner, open the options menu [⋮] and click Start flow. Then click Dashboard to exit the flow. Your flow is displayed on your Dashboard and is listening for your event – the processing of a new stock item by the Integration Bus message flow.

Finally, test your flow:

  1. Check that App Connect is listening to the Warehouse application.
    • In your web browser, go to https://iib_url/user01/warehouse/stock/hook. For example, for IBM Integration Bus on Cloud: warehouse_check_browser
    • In a command window, change to the C:\Warehouse directory, then run the command: curl -X GET https://iib_url/user01/warehouse/stock/hook

    Where iib_url (the host value that you set in the warehousedefinition.yaml file earlier) depends on whether you’re using Integration Bus on Cloud or Integration Bus Developer edition:

    • Integration Bus on Cloud: iib_url is the Service URL for the public endpoint of the Warehouse application on Integration Bus on Cloud.
    • Integration Bus Developer edition: iib_url is the host name and port for the IIB integration node.

    If the response is [], the Warehouse application has not connected to the Integration Bus message flow.

  2. Simulate the addition of new stock to the Warehouse.
    • In a REST client, use a POST action to https://iib_url/drive/newstock with the body set to a copy of the data in C:\Warehouse\purple_jumper.txt. For example (select the image to view at full size):
    • In a command prompt, run the command: curl -X POST https://iib_url/drive/newstock --data @purple_jumper.txt

      The data that you sent is displayed in the command window.

  3. Go to Gmail and sign in with the Gmail account that you used for Gmail in App Connect. In your Sent folder, you should see the email that was sent via App Connect.
  4. Log in to the email account that you entered in the To field of the flow and you should see the email in the inbox of that account.

You’ve created an App Connect custom application from an IBM Integration Bus message flow, and configured a event in the custom application to initiate an action in another application.

Join The Discussion

Your email address will not be published. Required fields are marked *