By using AWS re:Post, you agree to the Terms of Use
/How can we pass one Lambda function's event to another lambda?/

How can we pass one Lambda function's event to another lambda?

0

I am using AWS Lambda function in AWS Connect Contact Flow. I am invoking one lambda function from another lambda function. I want to pass my Invoker lambda function's event to second lambda function. My first lambda is receiving an event from Contact Flow but I want to call the second Lambda function by passing same event. Is there any way to use same event for my second lambda function. My first lambda function's event looks like this:

{'Details': {'ContactData': {'Attributes': {}, 'Channel': 'VOICE', 'ContactId': '7417-dc-45a-8213-e6eb0c68343c', 'CustomerEndpoint': {'Address': '+187737', 'Type': 'TELEPHONE_NUMBER'}, 'CustomerId': None, 'Description': None, 'InitialContactId': '74-456a-8213-e6eb343c', 'InitiationMethod': 'OUTBOUND', 'InstanceARN': 'arn:aws:connect:eu-central-1:048600317115:instance/ba4b5110-72fd-4511321-e8b2f', 'LanguageCode': 'en-US', 'MediaStreams': {'Customer': {'Audio': None}}, 'Name': None, 'PreviousContactId': '745585577-d37c-456a-8213-e0c68343c', 'Queue': {'ARN': 'arn:aws:connect:eu-central-1:04654567115:instance/ba4b5110-72fd-451b-a94d-a5b3555552f/queue/22555551-3b99-47ed-9cab-5a026122e56e', 'Name': 'outboundQueue', 'OutboundCallerId': {'Address': '+31205555689', 'Type': 'TELEPHONE_NUMBER'}}, 'References': {}, 'SystemEndpoint': {'Address': '+31205522559', 'Type': 'TELEPHONE_NUMBER'}}, 'Parameters': {'sf_fields': 'Id, Name, account.City_CB__c', 'sf_operation': 'phoneLookup', 'sf_phone': '.+4915959595195'}}, 'Name': 'ContactFlowEvent'}

How I can call second lambda function with the same event? How I can achieve this?

2 Answers
1
Accepted Answer

Just put the Event as the payload into your function. Then extract the original Event from the second Lambda Event.

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html#invoke-property

answered a month ago
1

It is an anti-pattern to call one lambda from another lambda. Please use SQS queue or step-functions as documented here - https://docs.aws.amazon.com/lambda/latest/operatorguide/functions-calling-functions.html

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions