Think 2021: New tools have the developer ecosystem and IBM building together Learn more

Integrate Watson AI into Salesforce apps


This developer pattern shows how to use the IBM Watson SDK for Salesforce to easily access Watson AI services inside Salesforce applications. Using the new Watson Salesforce SDK, you will be able to write Apex applications that access Watson services including Conversation, Language Translator, Discovery, and more.


If you’ve ever tried to integrate Watson using the Apex codebase, you know it can amount to hundreds of lines of code. Have no fear – there’s an SDK that can help speed that process up.

In November 2017, IBM announced the availability of the new Watson Salesforce SDK. It is just one of the many exciting things resulting from the IBM and Salesforce partnership. An SDK is an important tool in a developer’s toolbox. The Watson Salesforce SDK allows Salesforce developers to integrate Watson AI into Salesforce applications more easily than ever. In simple terms, it’s a bunch of pre-packaged code developers can quickly use to properly access the Watson APIs. Using an SDK saves immeasurable time and frustration. Integrating Watson using the Apex codebase typically requires writing hundreds of lines of code. Using the SDK, you can accomplish this with as few as five lines of code.

In this developer code pattern, we will use the new Watson Salesforce SDK by interacting with various Watson APIs in Apex, a Salesforce-specific programming language. The Watson Salesforce SDK currently supports:

  • Watson Conversation V1
  • Watson Discovery V1
  • Watson Language Translator V2
  • Watson Natural Language Classifier V1
  • Watson Natural Language Understanding V1
  • Watson Personality Insights V3
  • Watson Speech to Text V1
  • Watson Text to Speech V1
  • Watson Tone Analyzer V3

When you complete this code pattern, you will understand how to:

  • Create a Salesforce account.
  • Install the Watson Salesforce SDK.
  • Use the Watson Salesforce SDK to make calls to Watson Discovery and and Watson Tone Analyzer APIs.
  • Use the Lightning UI debugger to view the results of the APIs.



  1. Log into the Salesforce platform and brings up the Developer Console.
  2. Write Apex code into the Developer Console using the Watson Salesforce SDK.
  3. Execute the Apex code that calls the Watson APIs.
  4. The Watson API results are returned to the Salesforce Developer Console debugger.


Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.