Test the AWS Lambda Application

Before you connect the Lambda app to Amazon Connect, it’s best practice to test it to ensure it’s working as expected. It’s a powerful tool. Among other useful things:

  • It enables the lookup of the phone number of the person calling, matching it to an existing contact in Salesforce.
  • It can automatically open a case.
  • It can automatically update the case status when specific tasks are complete, up to closing the case.
  • It can also read back specific information, like the contact’s name, for a personalized experience.

Let’s test these features right in AWS. After that, you head to your playground to see the results firsthand.

Test Phone Lookup

  1. If you’re not there already, open the Lambda application you deployed, and head to the Overview tab. Lambda | Applications | serverlessrepo-AmazonConnectSalesforceLambda
  2. Scroll to the Resources section.
  3. Enter sfInvokeAPI in the search field, click enter (PC) or return (Mac) on your keyboard.
  4. Click the sfInvokeAPI Lambda function.
  5. Under the Function overview section, there are a series of tabs. Click Test.
  6. Give your test event a name, like PhoneLookupTest.
  7. Replace the JSON with the following code. For the value sf_phone, use the phone number you copied from your contact. Make sure it’s in E.164 format, like this: +14155551212.
    {
        "Details": {
            "Parameters": {
                "sf_operation" : "phoneLookup",
                "sf_phone" : "[ENTER PHONE NUMBER HERE]",
                "sf_fields" : "Id, Name, Email"
            }
        }
    }
  8. Click Save changes.
  9. Then, click Test.
  10. You get a success message, “Execution result: succeeded”. Click Details.
  11. Copy the value for ID and save it for your next test. In this example, it’s 0034x000009wRHHAA2

Execution result: succeeded message with details open

Test Case Creation

  1. Click X to dismiss the result log.
  2. Head back to the Test event section.
  3. Ensure New event is selected.
  4. Give your test a name.
  5. Replace the JSON with the following code. Replace the value for ContactId with the ID string you copied from the phone lookup test results.
    {
        "Details": {
            "Parameters": {
                "sf_operation" : "create",
                "sf_object": "Case",
                "Origin": "Phone",
                "Status": "New",
                "ContactID": "[ENTER ID HERE]",
                "Subject": "Amazon Connect Case",
                "Priority": "Low"
            }
        }
    }
  6. Click Save changes.
  7. Then, click Test.
  8. You get a success message, “Execution result: succeeded”. Click Details.
  9. The Id you see is the one for the case that was just created. Copy that value and save it for your next test. In this example, it’s 5004x00000580xCAAQ.

success message with the case ID in the results

 

Test Case Update

When your case was created, its status was set to New and its priority Low. Your next test will update the status.

  1. Click X to dismiss the result log.
  2. Head back to the Test event section.
  3. Ensure New event is selected.
  4. Give your test a name.
  5. Replace the JSON with the following code. Replace the value for sf_id with the case ID string you copied from the case creation test results.
    {
        "Details": {
            "Parameters": {
                "sf_operation" : "update",
                "sf_object": "Case",
                "sf_id": "[ENTER CASE ID HERE]",
                "Status": "Closed"
            }
        }
    }
  6. Click Save changes.
  7. Then, click Test.
  8. You get a success message, Execution result: succeeded. Click Details. You should see “Status”: 204. success message with the status returned as 204

Review Your Test Results

  1. In a new tab, log in to your playground.
  2. Navigate to Service Console | Cases.
  3. You should be in Recently Viewed with an Amazon Connect Case (1) listed. If you’re not there, you can enter amazon connect case in the case lookup (2). Click the case to see the case history and details.

Service Console Cases, with amazon connect case in the lookup and an Amazon Connect Case displayed

Now, all that’s left is to tie the Lambda app to your Amazon Connect instance for a fully functional data dip.

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities