Note: This article applies to the Adobe, AWS Lambda, Genesys Cloud, Google, Microsoft Dynamics 365, Salesforce, web services, and Zendesk data actions integrations.

When creating a custom action, first add contracts and then add configuration. The configuration defines how the action implements the contracts. For more information, see Create a custom action and Add contracts to custom actions.

Note: You can modify the configuration after you publish the action. For more information, see Modify configuration in custom actions.
  1. Click the Configuration tab. 
  2. Select the HTTP method.
  3. Under Request, configure the request that the action sends to the web service. Genesys recommends configuring the request by using the fields under Simple.
    Tip: Click the properties under Available Inputs to copy and quickly paste them in the request. These properties come from your input contract. For more information, see Add contracts to custom actions. You can use macros with the templates. For more information, see Velocity macros for data actions.

    Enter information for the fields that appear. The fields that appear vary depending on the HTTP method selected and the contracts added.

    Notes:
    • For the Adobe and AWS Lambda data actions integrations and Google Cloud Functions, see the following Special request configurations section.
    • Excessively nested JSON objects can affect the performance of the data action service. To maintain the performance, the depth of JSON objects is limited to 50 levels. For more information, see Limits in Genesys Cloud Developer Center.
    • Request URL Template

      Set the Request URL Template to the remote endpoint that your HTTP request hits.

    • Headers (optional)

      Key-value pairs that are added as HTTP headers on the request that is sent to the remote endpoint.

      Note: If you are setting the Accept header, you must use a JSON media type as the header value.

    • Transfer Encoding

      If your web service does not support Transfer-Encoding set to chunked, add Transfer-Encoding: buffered under headers. For more information, see Custom action fails for unexpected reason.

    • Authorization

      You can include authorization information in the request configuration. For more information, see How to use the User Defined credential type and How to use the User Defined (OAuth) credential type.

    Special request configuration

    The request configuration for custom actions that are associated with the Adobe or AWS Lambda data actions integrations or that execute the Google Cloud Functions vary from the standard request configuration for web services.

    • Headers

      Key-value pairs that are added to data actions at runtime for authentication handling:

      • x-api-key
      • x-gw-ims-org-id
      • x-sandbox-name (if configured)

        You can add a sandbox name to the integration credentials or as a header in an action. If the sandbox name is set in both places, the integration uses the header configured in the data action. For more information, see Add a data actions integration

    • Request URL Template

      Set the Request URL Template to the ARN of your AWS Lambda function. For more information, see Create IAM resources to invoke AWS Lambda functions.

    • Request Type

      Set Request Type to POST. This HTTP method ensures that the action sends any request body with the request configuration.

    • Headers

      Key-value pairs that are added to a custom map on the clientContext object. The clientContext object is in turn a value on the invocation context object. If the following attributes exist, they are automatically set on the context object:

      • ININ-Organization-Id
      • ININ-Home-Organization-Id
      • ININ-Correlation-Id
      • ININ-User-Id
      • ININ-Integration-Id

      For a Java example of the clientContext object, see Interface ClientContext

    • Request Template

      Any values that you specify under Request Template will be available in the event parameter of the invoked AWS Lambda function.

    • Request URL Template

      Set the Request URL Template to the location of the Google Cloud Function that you want the data action to execute: https://{location-of-function}-{project-owning-function}/{function-name}.

    • Request Type

      Set Request Type to POST.

    • Request Template

      Set Request Template to ${input.rawRequest}

    For a detailed explanation of the parts of the request, see Request configuration for data actions.

    People knowledgeable about JSON can use the JSON input option. Use requests in other actions or the following example as a guide for creating the JSON.

    {
      "requestUrlTemplate": "https://www.example.com/health/check/services/${input.service}",
      "requestType": "GET",
      "headers": {},
      "requestTemplate": "${input.rawRequest}"
    }

  4. Under Response, add the JSON configuration.

    The JSON configuration defines how the response from the web service or AWS Lambda function is processed.

    You can use the response in other actions or the following example as a guide for creating the JSON. For more information about using macros with the success template, see Velocity macros for data actions.

    Tip: Click the properties under Available Outputs to copy and quickly paste them in the response. These properties come from in your output contract. For more information, see Add contracts to custom actions.
    {
          "translationMap": {
              "buildNumber": "$.Build-Version",
              "serviceName": "$.name",
              "status": "$.Status"
          },
          "successTemplate": "{\r\n      \t\"build\": ${buildNumber},\r\n      \t\"name\": ${serviceName},\r\n\"status\": ${status}\r\n      }"
     }

    For a detailed explanation of the parts of the response, see Response configuration for data actions.

Next, test the action for validation and execution errors.

For more information, see About custom actions for integrations.

For more information about the integrations, see About the data actions integrations.