Example AWS Lambda data action with on-premises solution

Note: This article applies to the AWS Lambda data actions integration.

Prerequisites

  • An AWS Lambda data actions integration added to your Genesys Cloud organization. For more information, see Add a data actions integration.
  • An AWS account configured with an IP address that allows access to your on-premises solution.

You can use AWS Lambda data actions with on-premises solutions. For more information, see Data actions with on-premises solution overview and Workflow for data actions with on-premises solutions.

The following information provides example code for an AWS Lambda data action in Genesys Cloud and an AWS Lambda function in your Amazon VPC. The AWS Lambda data action in Genesys Cloud invokes your AWS Lambda function, which retrieves data from your on-premises solution. 

  1. In Genesys Cloud, create an AWS Lambda data action with the following code.

    This data action is associated with your AWS Lambda data actions integration in Genesys Cloud. For more information, see Create a custom action for integrations, Add contracts to custom actions, and Add configuration to custom actions.

    Input Contract
    {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "method": {
          "type": "string"
        },
        "headers": {
          "type": "string"
        },
        "body": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }
    Output Contract
    {
      "type": "object",
      "properties": {},
      "additionalProperties": true
    }
    Configuration Request
    {
      "requestUrlTemplate": "arn:aws:lambda:{{region}}:{{Lambda ID}}:{{Lambda function}}",
      "requestType": "POST",
      "headers": {},
      "requestTemplate": "{ \"url\": \"${input.url}\", \"method\": \"${input.method}\", \"headers\":${input.headers}, \"body\": ${input.body} }"
    }
    Configuration Response
    {
      "translationMap": {},
      "translationMapDefaults": {},
      "successTemplate": "${rawResult}"
    }
  2. In your AWS account, create an AWS Lambda function and upload the example code (.zip) to the function.

    For more information, see Create a Lambda Function with the Console in the AWS documentation.

For more information, see About the AWS Lambda data actions integration.