<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
How to Call Watson Natural Language Understanding (NLU) API from Workflows
Workflows
Okta Classic Engine
Okta Identity Engine
Overview

This guide details how to call the Watson Natural Language Understanding (NLU) API from Workflows.

Applies To
  • Workflows
Solution

    IBM Watson Natural Language Understanding (NLU) is a natural language AI service for advanced text analytics. The service can extract emotions (joy, anger, sadness, fear, and others) from text.

    An IBM Cloud account is required to call the API. To create one, sign up for a free account.

    Calling the Watson API

    The flow to call the Watson API looks like this:

    workflows watson api flow1


    The flow has the following cards:

    1. The Object – Construct card creates the request body payload.
      • text — is the text from which emotions are extracted.
      • features — This object instructs the API to extract emotional data from text. The API supports additional text analytics features.
    2. The Text–Compose card sets the endpoint URL. The URL is listed on the service’s Manage tab:

      watson watson api flow url  
    3. The API Connector – Post card makes the HTTP call after it receives the URL and body fields.


    One last part is the connection to the API. A custom connector is created for the Watson API.

    workflows watson api connector

     


    The Watson API uses Basic authentication. The connector setup looks like this:

    workflows watson connection

    Note: The apikey is the actual username for Watson APIs.


    Service response when running with I love building no-code automation input:

    {
      "usage": {
        "text_units": 1,
        "text_characters": 36,
        "features": 1
      },
      "language": "en",
      "emotion": {
        "document": {
          "emotion": {
            "sadness": 0.049281,
            "joy": 0.9057,
            "fear": 0.026308,
            "disgust": 0.003774,
            "anger": 0.016007
          }
        }
      }
    }
    
    
    
    


    The joy score is 0.9, which indicates it is a happy text.
     

    Related References

     

    Loading
    How to Call Watson Natural Language Understanding (NLU) API from Workflows