Message Image  

App Connect

Introducing support for Binary Files for IBM Watson Discovery 

Mon July 06, 2020 09:34 AM

Explore the new Binary File support for the Watson Discovery Service (WDS) application in App Connect. Watson Discovery is an analytics service which enables you to rapidly search both structured and unstructured data to extract meaningful insights.

The Watson Discovery Service application in App Connect now supports the upload of the following document formats – Word, PDF, HTML, and JSON. Data input can also be in binary format; this makes it easier to upload PDF and Word documents containing rich media content.

Connecting to Watson Discovery Service

Before you use App Connect with Watson Discovery, make sure you have created the Watson Discovery service in IBM Cloud and you have an environment and collection created for your account.

To work with the Watson Discovery Service in your App Connect flows, you’ll need to connect App Connect to your Watson Discovery Service 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 from 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 the Watson Discovery Service 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 a PDF file to the Watson Discovery Service.

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 Salesforce “Download attachment content”.
  • Version: Provide a version. Defaults to 2017-09-01.
  • 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 WDS specific errors in the WDS UI under “Errors and Warnings”.

If you’d like to try out this scenario, you can sign up here and get started in minutes. Here’s the flow definition file RetrieveFileContentFromGoogleDriveAndAddDocumentToWatsonDiscoveryService (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 Service”.

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



0 Favorited
1 Files
zip file
RetrieveFileContentFromGoogleDriveAndAddDocumentToWatsonD...yaml_   65 KB   1 version
Uploaded - Mon July 06, 2020