Global services

Updated at:

This topic describes how to create three types of global services: HTTP, Function Compute, and Short Message Service.

Overview

A global service is a system integration capability that allows a bot to call an external HTTP interface, Function Compute, or Short Message Service during a conversation. The Dialogue Factory supports direct calls to global services. For example, calling an external "weather check" HTTP interface from the Dialogue Factory enables your bot to respond to user requests for weather information, greatly expanding the bot's conversational abilities.

Important

The global service feature is unavailable in a business space created after March 30, 2025. This capability has been upgraded to the API plugin feature. You can configure it directly on the API plugin management page.

Create a global service

Create an HTTP global service

  1. Log on to the Intelligent Conversation Robot management console. In your bot's business space, navigate to knowledge base > global settings > global service to open the global service management page.image

  2. Click New Service. In the New Service window, set service type to HTTP Service and complete the form.

    Note

    The "HTTP Service" type calls an external HTTP interface.

    image

The following list describes the configuration parameters:

  • Service Name: A custom name for the service based on its function.

  • service type: The supported service types are HTTP Service, Function Compute, and Short Message Service. For this procedure, select HTTP Service.

  • service call mode: Specifies whether the call is synchronous (waits for a result) or asynchronous (proceeds immediately).

    • Synchronous: If you select this mode, a response is generated and returned only after the service call is complete or times out.

    • Asynchronous: If you select this mode, the caller must retrieve the service result separately.

      • Enable Polling: If you select Yes, channels such as instant messaging (IM) and outbound calls will poll the interface. If the asynchronous service has a result, the interface returns the parameters.

    Note

    For a synchronous call, the system waits for the service to return before executing subsequent actions. If the service response affects the QA engine's next action, use a synchronous service.

    Asynchronous calls are suitable for two scenarios:

    For example, if the bot needs to send a customer a reminder text message while providing an answer, and this call to the messaging service does not affect the subsequent QA flow, you can use an asynchronous service. Set Enable Polling to No. This provides a smoother user experience.

    In some cases, the service response affects the QA engine's next action, but the business interface has high latency (such as a ticket booking service). Calling such a service and waiting for the result can increase dialogue latency and degrade the user experience. In this situation, use an asynchronous service and set Enable Polling to Yes. Channels such as IM and outbound calls will then poll the interface. If the asynchronous service has a result, the interface parameters are returned.

  • service timeout: The maximum time to wait for a service response. If this time is exceeded, the call fails with a timeout message.

  • service request parameter: The input parameters for the service.

  • service interface: The third-party interface to call.

  • Request Parameters: The input parameters required by the third-party interface. You can reference a service request parameter by using the ${parameter_name} format, for example, ${city}.

Note
  • The system currently supports the HTTP protocol with GET and POST request methods.

  • Service Return Parameters: Defines the output parameters of the service. In a service node, you can assign the values of these parameters to a global variable.

  • The interface must return a UTF-8 encoded string.

    • Full reference: Use result=${serviceOutput} to assign the entire response to the result variable for use in downstream modules.

    • Field extraction: If the response is a JSON-formatted string, you can use result=${serviceOutput.name} to directly extract the value of the name field.

Example

image.png

Parameter description:

  • service request parameter: Defines the service's input parameters. For example, a weather query service requires a city.

  • service interface: The third-party interface to call.

    • request method: GET

    • Request URL: http://127.xx.xx.xx/smsapi

  • Request Parameters: The input parameters required by the third-party interface. You can reference a service request parameter by using the ${} format, for example, ${city}.

  • Interface Response: The result from the service interface. Use ${serviceOutput} to assign it to a service return parameter.

  • Service Return Parameters: Defines the parameters returned by the service. In a service node, you can assign these parameters to a global variable.

Create a Function Compute global service

  1. Click New Service. In the New Service window, set service type to Function Compute and complete the form.

    image

The following list describes the configuration parameters:

  • Service Name: A custom name for the service based on its function.

  • service type: The supported service types are HTTP Service, Function Compute, and Short Message Service. For this procedure, select Function Compute.

  • Select Service/Function: The service you select must be created in Function Compute 2.0.

  • service request parameter: The input parameters for the service.

  • Service Return Parameters: The output parameters of the service.

image

image

Note

Create a Short Message Service global service

  1. Click New Service. In the New Service window, set service type to Short Message Service and complete the form.

    image

The following list describes the configuration parameters:

  • Service Name: A custom name for the service based on its function.

  • service type: The supported service types are HTTP Service, Function Compute, and Short Message Service. For this procedure, select Short Message Service.

  • Select signature/template: The signature and template must be created in Short Message Service.

  • Service Return Parameters: Use this parameter to check whether the message was sent successfully.

Note