App Connect

 View Only

Using IBM® App Connect to interact with AWS Lambda

By Shahmini Arumugam posted Fri October 07, 2022 02:05 AM

  

Co-author – Srihari Ananda Kumar 

AWS Lambda is an event-driven, serverless computing platform offered by Amazon Web Services (AWS). It allows you to run code for applications or backend services without provisioning or managing servers.

Building a flow in IBM App Connect with AWS Lambda

 

Use App Connect to build flows that integrate with AWS Lambda and other applications. The connector is displayed as AWS Lambda on the App Connect User Interface (UI).

To allow App Connect to connect to your AWS Lambda account, you need to fill in the connection fields that you see in the App Connect Designer Catalog page or flow editor. For more information on connection fields, see How to use IBM App Connect with AWS Lambda.

AWS Lambda objects

The following are AWS Lambda action objects that can be run in App Connect.

Objects

Description

Functions

 

A Lambda function runs in its own container; after it is created, Lambda packages it into another container, which is then executed on a multi-tenant cluster of machines controlled by AWS. 

 

Scenario 1: Invoke a function from AWS Lambda whenever an opportunity gets created in Salesforce

 

Consider this scenario where you invoke a predefined function from AWS Lambda when an opportunity gets created in Salesforce. In this example, the flow will create and populate the Salesforce opportunities table on a webpage that contains the opportunities and revenue details. This information is shared via Gmail with all the relevant stakeholders. This data helps to project the total revenue of the opportunities for the upcoming quarter.


In this example, we have created an AWS function called LambdaUC via an AWS Lambda function handler which processes the Salesforce opportunity details such as opportunity ID, Name, and revenue Amount.

The following example is the function handler’s snippet from index.js of the LambdaUC function where the opportunity ID, name, and revenue amount will be used to parse in App Connect.



In this flow:

  1. You run an action-based flow that invokes an AWS Lambda function whenever an opportunity gets created in Salesforce.
  2. With the Invoke function operation, it synchronously invokes the LambdaUC function based on the payload properties. The payload properties are the JSON data that you want to provide to your AWS Lambda function as input.
    For example:

    • The Qualifier is set to take the latest version to invoke the published version of the function.
    • The Invocation type is set to RequestResponse to invoke the function synchronously.
    • The Log type is set to Tail to include the execution log in the response.
    • In the Payload properties, the Salesforce Opportunity ID, Name, and revenue Amount are being parsed by the JSON parser for processing.
  3. A JSON Parser node from the App Connect toolbox is used to parse the Payload properties and output the JSON schema in a table form on a webpage that contains the Salesforce opportunities and revenue details.

         The JSON Parser is used to convert a string of JSON text into a JSON object. The output schema generated exposes the object's 
         properties for use as input in a subsequent action in the flow.


        For example, the Salesforce opportunities table on a webpage contains the opportunities and revenue details. Whenever an   
        opportunity gets created, the table is repopulated with the latest data.

  4. An email gets sent from your Gmail account to the intended stakeholders whenever the AWS Lambda function is successfully invoked.

    For example:

    The URL is the user-defined webpage to populate the LambdaUC function output.
    You can configure the URL from the AWS Lambda console. A function URL is a dedicated HTTP(S) endpoint for your Lambda function.  



Resources

Try out our templates

You can view the following use cases in the Templates gallery in your App Connect Designer instance.

  • Invoke a function from AWS Lambda whenever an opportunity gets created in Salesforce

    Template URL: https://<your-instance-id>/templates/Invoke%20a%20function%20from%20AWS%20Lambda%20whenever%20an%20opportunity%20gets%20created%20in%20Salesforce


You must enable the Designer AI features in your containerized environment in order to access the App Connect templates. For more information, see The preloaded IBM App Connect templates.

You can also import these use cases directly into your App Connect Designer. These templates are added to a public GitHub repository at https://github.com/ot4i/app-connect-templates/tree/cp4i-templates/resources.

 

0 comments
41 views

Permalink