InvokeTelephonyIntegrationApiFunction Lambda Function

The invokeTelephonyIntegrationApi function either creates VoiceCall records for inbound calls and transfers, or executes the Omni-Channel flow and returns the rep or queue routing instructions to the contact flow.

Configuration: This function is available to Service Cloud Voice customers who are using an Amazon Connect instance that’s provided by Salesforce. No additional configuration is necessary. See a sample version of the invokeTelephonyIntegrationApi Lambda function in GitHub.

Description: Use this Lambda function to create a VoiceCall record or execute an Omni-Channel flow. Creating a VoiceCall is essential to get the call working, which is why this function is typically one of the first blocks in your contact flow for an inbound call. This Lambda is invoked to perform the following actions:

  1. Create a VoiceCall for an inbound call. This action occurs when a customer calls into the call center.
  2. Create a VoiceCall for a call transfer. This action occurs when a rep transfers to another rep or queue.
  3. Execute an Omni-Channel flow. This action occurs when work is ready to be routed.
  4. Cancel an Omni-Channel flow. This action occurs when an existing flow needs to be canceled.

When a Lambda function hasn’t been invoked after a period of time, the AWS framework unloads the function from memory. The next time the function is invoked, it is “cold” and takes longer to load into memory. This delay can cause a timeout in the contact flow. To avoid this behavior, learn how to keep this function warm.

Important

Sample Contact Flows That Use This Function: Sample SCV Transfer Flow for Agent Transfers Sample SCV Transfer Flow for Queue Transfers, Sample SCV Inbound Flow. To download these flows, visit our Sample Contact Flows folder in GitHub.

Usage: Place this Lambda within one of the relevant contact flows (either for an inbound call or a transfer). This Lambda takes a “methodName” attribute as an argument. This attribute indicates the specific action that the Lambda must perform.

Table 1. Input Attributes
Action Attribute Key Attribute Value
Create a voice call for an inbound call methodName createVoiceCall
Create a voice call for a transfer methodName createTransferVC

Request routing instructions from an Omni-Channel flow and create a PendingServiceRequest.

Calls routed with this method appear in the Queue Backlog tab of Omni Supervisor. If a PendingServiceRequest isn’t created and the voice call isn’t routed by Omni-Channel, then the Queue Backlog tab doesn’t show the call. For example, calls that are manually assigned to a rep don’t appear in that tab.

Note

Optionally, provide these inputs:
  • flowDevName. Set the Omni-Channel flow using its developer name.
  • fallbackQueue. Set the fallback queue using its Salesforce queue developer name or ID.
  • Custom parameters with prefix flowInput-. Set additional inputs to the Omni-Channel flow.

By default, Service Cloud Voice uses the Omni-Channel flow (or fallback queue) specified for the phone channel that matches the dialed number. If the dialed number doesn’t match an existing phone channel, you can optionally set the Omni-Channel flow or fallback queue in these input parameters. The fallback queue is used only if the specified flow doesn’t exist or one isn’t specified.

methodName executeOmniFlow
Cancels an Omni-Channel flow that was previously executed. This method also calls the Clear Routing REST API to clear the PendingServiceRouting (PSR) record. methodName cancelOmniFlowExecution

When creating a voice call record, you can also specify custom data to be added to fields on the VoiceCall record. To add custom date, create a “Set contact attributes” block before the Lambda call. For the destination attribute, specify the name of the custom field with the “sfdc-” prefix added. The value of this attribute is the data to pass into the custom field For an example, see Pass Data from the Interactive Voice Response (IVR) System.

Table 2. Output Attributes for createVoiceCall and createTransferVC
Output Attribute Name Description
voiceCallId ID of the voice call.
Table 3. Output Attributes for executeOmniFlow
Output Attribute Name Description
agent The rep to route the call to
queue The queue to route the call to
errors List of errors why the call couldn’t be routed