Watson Discovery

Expand Watson Discovery connectivity with IBM App Connect

By FREDRIK TUNVALL posted Fri November 20, 2020 02:49 PM

By: Aparna Srinivasan and Fredrik Tunvall

IBM App Connect allows customers to instantly connect applications and data, from existing systems and modern technologies across all
of their environments. The solution also offers enterprise service bus (ESB) and agile integration architecture (AIA) microservices deployment of integration artifacts, allowing customers to deploy to a multitude of flexible integration patterns. The integration between Watson Discovery and IBM App Connect enables users to easily connect to a plethora of applications, utilities, and data sources currently not part of the Watson Discovery tooling, such as Google Drive, Microsoft Dynamics, and SAP ERP.

Connecting to App Connect
Before you use Watson Discovery with App Connect, make sure you have created a Watson Discovery and an App Connect instance in the IBM Cloud and you have an environment and collection created for your Watson Discovery account. You can find more info on how to set up a Watson Discovery instance here, and an App Connect instance here.

To work with the Watson Discovery in your App Connect flows, you’ll need to connect App Connect to your Watson Discovery account by providing a set of connection details. For more information, see  How to use IBM App Connect with IBM Watson Discovery. You can connect either by using the Applications tab in the App Connect Catalog page, or when you add the app to a flow.

There are multiple use cases for integrating Watson Discovery with other applications and utilities in the App Connect catalog. In this blog, we are going to illustrate a scenario where a ‘Scheduler’ schedules a flow to run once a day to create a PDF file in Google Drive which is then retrieved using a “Retrieve File Content” operation and then uploads that PDF file to a Watson Discovery collection.

To begin, we’ll create an event-driven flow. We’ll access the Toolbox to add a Scheduler as the first node, and then schedule the flow to trigger every 24 hours.

Next, we click (+) > Google Drive > Files > Create file. This will add a file to Google Drive.

Then, we provide the File name, Mime Type, File Content in base64 encoded format, and a description for the “Create File” input fields.

Next, we click
(+) > Google Drive > Files > Retrieve file content. This will retrieve the binary file content (in this case, a PDF document).

Once added, we map to the Google Drive
File ID object (from the Create File response) and add the type of file to be retrieved.

Next, we click
(+) > Watson Discovery Service > Documents > Add document. This will add a binary file (in this case, a PDF document) to the service.

Once added, we select the Environment and Collection to be used.

Now, we populate the following values:
  • Source ID: Provide any unique ID here.
  • Source: Provide any unique ID here.
  • Payload input type: Select base64encoded. (For Base64 encoded string select base64encoded, for JSON select text).
  • Payload in the file to index: Map to file content response from Google Drive.  “Download attachment content”.
  • Version: Provide a version of the Discovery API to use. Defaults to 2019-04-30. Latest release can be found here.
  • FileName: Provide a file name to match the uploaded content. Defaults to _.json.

Finally, we start the flow and wait for the scheduled time. A PDF is added to the Watson Discovery Service under the specified Environment and Collection.

You can view the
Watson Discovery specific errors in the WD UI under “Errors and Warnings”.

If you’d like to try out this scenario, you can sign up for Watson Discovery here, and App Connect here. and get started in minutes. The flow definition file (RetrieveFileContentFromGoogleDriveAndAddDocumentToWatsonDiscoveryService) is attached below for you to import and use as a template.

You can also access the template from the template gallery in App Connect by searching for “Retrieve file content from Google Drive then add the document to the Watson Discovery”.

We’d also love to hear from you. Why not share some of your use cases with us or send us any other comments?

Aparna Srinivasan works as an IBM App Connect developer. She has 8 years of experience working with various technologies like Java, RFT, and node.js. She was working as a backend developer for IBM App Connect. She has completed her Bachelor of Engineering from Anna University, Chennai. 

Fredrik Tunvall is part of the Offering Management team for IBM Watson Discovery and NLU. In this role he is responsible to drive growth and awareness of the platforms through strategic initiatives across all routes to market. He collaborates with clients, business partners, as well as IBM engineering, marketing, and sales to create and optimize business value and drive adoption.