HTTP Request

This topic provides an overview of the HTTP Request component, and describes its configuration, variables, as well as supported connections.

Component introduction

HTTP Request component allows you to send HTTP requests to external web servers, enabling data exchange with third-party services. The response is stored in variables, which can be used as input for subsequent components or for condition evaluation.
Supported request types
  • GET

  • HEAD

  • OPTIONS

  • POST

  • PUT

  • TRACE

  • DELETE

Supported content types
  • application/javascript
  • application/json
  • application/x-www-form-urlencoded
  • application/pdf
  • application/xml
  • application/zip
  • multipart/form-data
  • text/css
  • text/html
  • text/plain
  • image/png
  • image/jpeg
  • image/gif

Component configuration

  1. After adding Developer component to a call flow, click Developer component to proceed with the configuration.

  2. In the Component Type drop-down list, select HTTP Request.

  3. Configure the HTTP request.
    Item Description
    URI

    Enter the target URI to which the HTTP request will be sent.

    You can enter specific URI, or click to configure an expression.

    Expression example:

    FX_CONCATENATE("https://crm.example.com/check-caller?callernum=",$Session.ani)

    In this example, the request is sent to a CRM system to verify the caller's number and identify the caller type.

    Note: For more information about the expression, see Variables and Functions in Yeastar Expression.
    Request Type Select the HTTP method to use.
    • GET

    • HEAD

    • OPTIONS

    • POST

    • PUT

    • TRACE

    • DELETE

    Content Type Select a content type.
    • application/javascript
    • application/json
    • application/x-www-form-urlencoded
    • application/pdf
    • application/xml
    • application/zip
    • multipart/form-data
    • text/css
    • text/html
    • text/plain
    • image/png
    • image/jpeg
    • image/gif
    Query Parameter Click Add to add query parameters.

    You can enter specific query parameter, or click to configure an expression.

    Note:

    Expression example:

    • Key expression:
      FX_CONCATENATE("call_to_", $Session.did)		
    • Value expression:
      $Session.ani

    In this example, the query parameter is dynamically generated to pass both the caller's number and the dialed number, allowing the CRM system to identify which trunk or service line the caller dialed into.

    Content Enter the request body to be sent to the server.
    Timeout(s) Set the time in seconds to wait for the HTTP request to complete.
    Header Click Add to specify HTTP headers for the request.

    You can enter specific header, or click to configure an expression.

    Note:

    Example:

    • Name: X-Caller-ID
    • Header: $Session.ani

    In this example, the header name is fixed as X-Caller-ID, while the value is dynamically retrieved using the variable $Session.ani, allowing the CRM system to obtain the caller's number from the request header and use it to look up customer records or match existing contact information.

  4. At the bottom-right corner, click Confirm.

Component variables

When a HTTP Request component is added to a call flow, the system stores response information in variables. These variables can be referenced in expression-supported components, such as Condition or Developer, to retrieve the response information and respond accordingly based on the result.

Note: Since HTTP Request component can be added multiple times in a call flow, an index is appended to each component (e.g. HTTP Request 1, HTTP Request 2) based on the order in which the components are added. To retrieve data from the right component, the component variable must contain the corresponding index.
Variable Type Description Example Value
$HttpRequest{index}.responseContent String The body content returned from HTTP response.

{"authenticated": true, "user": "10000"}

$HttpRequest{index}.responseStatusCode String The HTTP status code returned from the request.
Note: When using functions to evaluate HTTP status code, ensure that the constant is a numeric code, without any accompanying text.
"200"

Component connections

HTTP Request component can be connected to one component, which can be any of the components listed below.

Component Description
Prompt

Prompt component allows you to play audio prompt(s) or a text-to-speech message to callers.

For more information, see Prompt.

Business Hours

Business Hours component allows you to route calls to different destinations based on the time of day.

For more information, see Business Hours.

Menu Menu component allows you to present callers with a set of menu options, and route calls based on the DTMF digit they press.

For more information, see Menu.

User Input

User Input component allows you to collect DTMF digits from callers, typically used with Condition component to evaluate user input and route calls.

For more information, see User Input.

Language

Language component allows you to change the system prompt language for subsequent components in a call flow.

For more information, see Language.

Record Record component allows you to start recording a call upon the caller being connected to another participant, and optionally configure prompts to inform call participants at the start and during the recording. Alternatively, you can use the component to disable call recording for calls that are supposed to be recorded.

For more information, see Record.

Dial by Number

Dial by Number component allows callers to directly dial a number to reach the destination.

For more information, see Dial by Number.

Dial by Name

Dial by Name component is one of the end components to terminate caller's connection to the current call flow. It allows callers to reach extension user by entering the first three letters of the user's name.

For more information, see Dial by Name.

Transfer

Transfer component is one of the end components to terminate caller's connection to the current call flow. It allows you to transfer callers to a designated destination, and optionally configure prompts to inform them of the transfer.

For more information, see Transfer.

Hang Up Call

Hang Up Call component is one of the end components to terminate caller's connection to the current call flow. When callers are routed to the component, the call will be disconnected.

For more information, see Hang Up Call.

Condition Condition component allows routing calls based on logical expressions.

For more information, see Condition.

Loop Loop component allows a group of components to be executed repeatedly, either for a specified number of times or until a condition is met.

For more information, see Loop.

Developer Developer component allows you to query and update data from PBX-native database or third-party database.