Message Image  

Introducing support for Binary Files for IBM Watson Discovery

 View Only
Mon July 06, 2020 08:47 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 use the Watson Discovery service click the following link – IBM Cloud Watson Services

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



You can connect either from the Applications tab in the App Connect Catalog page, or when you add the app to a flow.

Username: The username for your Watson Discovery Service Account. 
Password: The password for your Watson Discovery Service Account. 


Scenario

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 the flow to run once a day to retrieve the PDF attachment added to a Salesforce account and then the PDF file is uploaded 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 (+) > Salesforce > Attachment > Download attachment content. This will add the attachment content from Salesforce.


Now we navigate to Salesforce and get the Attachment ID from the connected account to upload the attachment.


Then, we provide the attachment ID as input for the “Download attachment content” Attachment ID field.


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 DownloadAttachmentFromSalesforceAndAddDocumentToWDS (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 “Download a PDF attachment from Salesforce and add the PDF 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?


#Watsondiscovery
#Binaryfiles
#analytics

Attachment(s)
zip file
DownloadAttachmentFromSalesforceAndAddDocumentToWDS.zip   2 KB   1 version
Uploaded - Mon July 06, 2020