Creating a Function Data Action via CX as Code

I have a CX-as-Code project using the Genesys Cloud Provider v1.55.0. I'm trying to create a Function Data Actions type Integration and an accompanying Data Action. Here's the Terraform code:

# A Function Data Actions Integration
resource "genesyscloud_integration" "functionDataAction" {
  integration_type = "function-data-actions"
  intended_state   = "ENABLED"
  config {
    name  = "Function Data Action Test"
    notes = "A Function Data Actions Integration"
  }
}

# A Data Action which executes the Function Data Action Integration
resource "genesyscloud_integration_action" "functionDataAction" {
  name           = "Function Data Action Test"
  integration_id = genesyscloud_integration.functionDataAction.id
  category = "Function Data Actions"

  contract_input  = "{\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"additionalProperties\":false,\"properties\":{\"input1String\":{\"description\":\"Example string input\",\"type\":\"string\"},\"input2Boolean\":{\"description\":\"Example boolean input\",\"type\":\"boolean\"},\"input3Number\":{\"description\":\"Example number input\",\"type\":\"number\"}},\"type\":\"object\"}"
  contract_output = "{\"additionalProperties\":true,\"properties\":{},\"type\":\"object\"}"

  config_request {
    request_url_template = "503b5cb7-864f-4439-ab8a-c73f77c40768"
    request_type         = "GET"
    request_template     = "$${input.rawRequest}"
    headers = {
      Cache-Control = "no-cache"
    }
  }

  config_response {
    success_template = "${rawResult}"
  }
}

When I run the code, it successfully creates and activates the Integration. However, it fails to create the Data Action, providing this error:

Error: Exhausted retries. Last error: 

[{0 Failed to create integration action Dev Function Data Actions error: 
API Error: 400 - Integration 'ff5010a0-3012-4207-b4b7-e10c096279aa' of type: 'function-data-actions' does not support creating published actions (24f486f7-47b2-46d0-a75a-166808f71cfd) {"resourceType":"genesyscloud_integration_action","method":"POST","path":"/api/v2/integrations/actions","statusCode":400,"errorMessage":"API Error: 400 - Integration 'ff5010a0-3012-4207-b4b7-e10c096279aa' of type: 'function-data-actions' does not support creating published actions (24f486f7-47b2-46d0-a75a-166808f71cfd)","correlationId":"24f486f7-47b2-46d0-a75a-166808f71cfd"} []}]

However, using the Genesys Cloud user interface, I'm able to create and publish a Data Action using this exact same Integration.

Does the GC Terraform Provider not work with Function Data Actions yet? Should I change my configuration?

Update... I tried to create the same Action using the POST /api/v2/integrations/actions API, and I got the same error:

The request failed with response code: 400. Message: Integration 'ff5010a0-3012-4207-b4b7-e10c096279aa' of type: 'function-data-actions' does not support creating published actions.

I think this makes sense as the genesyscloud_integration_action says if uses the /integrations/actions API endpoints, not those using the /draft path. For the record, the POST /api/v2/integrations/actions/drafts API does NOT throw an error with this type.

In the Github repo for the CX as Code provider, I see in Issue #895 the development team will not implement a method to create a draft Data Action. I generally agree with the reasoning. However, I don't know what we should do in these scenarios where the Integration type requires us to do a draft action first.

It's my hope that since Function Data Actions are technically still in Beta, when they are Generally Available we will be able to create them using CX as Code. I'd welcome some input from the GC development team, too.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.