This application provides a set of Lambda functions, which are available within your Amazon Connect instance after provisioning the instance with your Service Cloud Voice contact center. You can use these Lambdas in Amazon Connect contact flows.
BSD 3-Clause "New" or "Revised" License
14
stars
18
forks
source link
Support returning nested JSON instead of flattened data in REST API Lambda #68
The REST API Lambda would benefit from returning standard JSON. In the current release, the Flat library is used to return results that are potentially nested.
So for example, given a SOSL search query returning this result snippet
currently requires the type to be accessed like this: ['attributes.type'] whereas you should be able to access it using normal dot notation when setting the Lambda Invocation Response Validation in the Contact flow to "JSON" instead of "STRING MAP" as described in the Amazon Connect Documentation and introduced in the March 2023 Release of Amazon Connect.
I assume the code in the Salesforce Service Cloud Voice REST API Lambda used flattening because this feature is relatively new and initially you had to work with STRING MAP validation; however JSON support has now been around over a year and is much more intuitive and powerful. I understand changing this is potentially a breaking change for some customers; however feature flags would easily be able to handle that. In addition, being able to handle arrays would be very useful - per the AWS docs this is currently only supported by forwarding the data to another Lambda; rather than direct use in the flow; but even that opens a number of important and powerful use cases.
Is support of JSON for Amazon Connect Lambda invocations for REST APIs already planned? If not please let me know how to best progress this - via this issue, an Idea, etc. Also happy to create a PR; however the version of the Service Cloud Voice Code in this repository is outdated as indicated in https://github.com/service-cloud-voice/ServiceCloudVoiceLambdas/issues/66
The REST API Lambda would benefit from returning standard JSON. In the current release, the Flat library is used to return results that are potentially nested.
So for example, given a SOSL search query returning this result snippet
currently requires the type to be accessed like this:
['attributes.type']
whereas you should be able to access it using normal dot notation when setting the Lambda Invocation Response Validation in the Contact flow to "JSON" instead of "STRING MAP" as described in the Amazon Connect Documentation and introduced in the March 2023 Release of Amazon Connect.I assume the code in the Salesforce Service Cloud Voice REST API Lambda used flattening because this feature is relatively new and initially you had to work with
STRING MAP
validation; howeverJSON
support has now been around over a year and is much more intuitive and powerful. I understand changing this is potentially a breaking change for some customers; however feature flags would easily be able to handle that. In addition, being able to handle arrays would be very useful - per the AWS docs this is currently only supported by forwarding the data to another Lambda; rather than direct use in the flow; but even that opens a number of important and powerful use cases.Is support of JSON for Amazon Connect Lambda invocations for REST APIs already planned? If not please let me know how to best progress this - via this issue, an Idea, etc. Also happy to create a PR; however the version of the Service Cloud Voice Code in this repository is outdated as indicated in https://github.com/service-cloud-voice/ServiceCloudVoiceLambdas/issues/66