GitHubContribute in GitHub: Edit online

copyright: years: 2017, 2021 lastupdated: "2023-02-10"


Dynamically configuring the Watson Assistant service or service orchestration engine for SMS Gateway

By using the SMS Gateway API, you can dynamically configure the IBM Watson™ Assistant service or service orchestration engine during a chat session. To change the configuration, define the smsActSetConversationConfig action in the output of a node response in your Watson Assistant dialog tree. If any text is provided in the original conversation turn, that text will be concatenated with any new text provided before sending message to the user. This action will support all the parameters that are defined in action details. For more information, see API for SMS Gateway.

The attributes that you can define for the smsActSetConversationConfig action each correspond with a configuration environment variable. If an attribute isn't defined in the Watson Assistant service, the value from the related environment variable is used.

See the following sections for examples of defining the smsActSetConversationConfig action:

Watson Assistant service

Important: provide the user name and password combination, or apikey, as specified by your Skill API Details.

The following examples show how to define a Watson Assistant workspace.

{
  "output": {
    "smsAction": {
      "command": "smsActSetConversationConfig",
      "parameters": {
        "url":"https://api.us-south.assistant.watson.cloud.ibm.com/instances/{instance_id}",
        "workspaceID":"a23de67h-4e92-4565-c1b5-ebd59a2ffcad",
        "apikey": "PqxxxxrbuJ2ZxxxjZfyYe5oNRdY6AWdTa_xxxxEHVwCq"
      }
    }
  }
}
      "parameters": {
        "url": "https://api.us-south.assistant.watson.cloud.ibm.com/instances/{instance_id}",
        "apikey": "PqxxxxrbuJ2ZxxxjZfyYe5oNRdY6AWdTa_xxxxEHVwCq",
        "workspaceID": "cxxxxxc-4ea2-4234-b600-3xxxxxx0764ba"
      }

Service orchestration engine

Because configuring a service orchestration engine uses the same environment variables as configuring the Watson Assistant service, you also change this configuration on the smsActSetConversationConfig action.

Important: If you switch between a directly configured Watson Assistant service and a service orchestration engine, set the workspaceID attribute to an empty value to so that the configuration does not use the value from the configuration.

{
  "output": {
    "smsAction": {
      "command": "smsActSetConversationConfig",
      "parameters": {
        "url":"https://soe-example.net",
        "username":"adminuser",
        "password":"XgUCZZItgZD0"
      }
    }
  }
}
Table 1. Attributes for connecting to a service orchestration engine
Attribute Description Related environment variable
url The exact URL to the service orchestration engine. WATSON_CONVERSATION_URL
workspaceID If switching from a Watson Assistant service, set to "" to clear the workspace configuration. WATSON_CONVERSATION_WORKSPACE_ID
username The plain-text user name for the service orchestration engine. Required only if authentication is enabled in the SOE. WATSON_CONVERSATION_USERNAME
password The plain-text password for the service orchestration engine. Required only if authentication is enabled in the SOE. WATSON_CONVERSATION_PASSWORD