0

I have an AWS Connect Contact Flow... it invokes a Lambda Function as below: enter image description here

Now, I've followed the docs and set my destination key aligned to the name of the parameter in my Lambda function. enter image description here

But now matter what I try even setting a phone number manually... the flow sends an empty JSON object to my lambda function.

This is eating my lunch, anyone have a solution?

CSharpMinor
  • 202
  • 1
  • 9
  • This solves PART of the problem, but but it doesn't address custom parameters https://stackoverflow.com/a/48597243/2544291 – CSharpMinor Mar 28 '23 at 02:07

3 Answers3

0

Looks like you are not publishing your flow and you are retrying just by saving the flow.

0

This issues is with the object being passed from AWS connect to the Lambda function. The custom json items are attached to the "Parameters" object on the "Details" object.

CSharpMinor
  • 202
  • 1
  • 9
0

I think I have solved this. You need to create the same class structure for the Contact flow. What I create is below and I just added custom name under "Parameters" which is the "DialedNumber" and I have put the same name in the Function Input parameters in Invoke AWS Lambda Function under the "Destination Key" and to test I set the value to manually but it will depend on your logic. Then you need to put the class in your function as the 2nd image.

1st Image in AWS Lambda Function input parameter
2nd Image in c# Function

public class Parameters
{
    public string DialedNumber { get; set; }
}
public class ContactFlowModel
{
    public string Name { get; set; }
    public Details Details { get; set; }
}

public class Attributes
{
}

public class Audio
{
    public string StartFragmentNumber { get; set; }
    public string StartTimestamp { get; set; }
    public string StreamARN { get; set; }
}

public class ContactData
{
    public Attributes Attributes { get; set; }
    public string Channel { get; set; }
    public string ContactId { get; set; }
    public CustomerEndpoint CustomerEndpoint { get; set; }
    public string InitialContactId { get; set; }
    public string InitiationMethod { get; set; }
    public string InstanceARN { get; set; }
    public MediaStreams MediaStreams { get; set; }
    public string PreviousContactId { get; set; }
    public object Queue { get; set; }
    public SystemEndpoint SystemEndpoint { get; set; }
}

public class Customer
{
    public Audio Audio { get; set; }
}

public class CustomerEndpoint
{
    public string Address { get; set; }
    public string Type { get; set; }
}

public class Details
{
    public ContactData ContactData { get; set; }
    public Parameters Parameters { get; set; }
}

public class MediaStreams
{
    public Customer Customer { get; set; }
}
   
public class SystemEndpoint
{
    public string Address { get; set; }
    public string Type { get; set; }
}