Skip to main content

Integrating Fin Voice with Amazon Connect using call forwarding

Learn how to connect Fin Voice to Amazon Connect using PSTN call forwarding to resolve customer questions instantly with AI.

Dawn avatar
Written by Dawn
Updated over a month ago

This guide helps you connect Fin Voice, Intercom’s AI Agent for phone support, with your Amazon account. By following these steps, you can instantly answer customer calls using your Help Center content, while ensuring that complex issues are seamlessly handed off to your human team with a full AI-generated summary and transcript.

Pro tip: This integration uses the Intercom API. We recommend having a technical teammate or developer assist with the script configuration in Amazon Connect Flow Designer.


How the integration works

This integration uses Public Switched Telephone Network (PSTN) forwarding to route calls between Amazon and Intercom:

  1. Amazon → Fin Voice: Amazon forwards inbound calls to a dedicated Fin Voice number purchased in Intercom.

  2. Fin Voice resolution: Fin answers instantly, using your Help Center to resolve the issue.

  3. Fin Voice → Amazon: If Fin cannot resolve the call, it forwards the caller back to a dedicated Amazon escalation number.

  4. Context transfer: Amazon Connect uses the Fin Voice API to retrieve the call summary and transcript for your teammates.

Important: This integration only works when Amazon Connect, Lambda, and Fin Voice are wired in a specific order. Deviating from this will cause silent hang-ups.

  • Lambda must run before the transfer: You must register the intent via Lambda before the transfer block.

  • Delay is required: A short delay (Play prompt) must exist immediately before the Transfer block.

  • One path only: There must be exactly one success path into the Transfer block.

  • Caller ID: Must be a valid E.164 phone number. Never mix manual and dynamic caller ID settings.


Before you start

Ensure you meet the following requirements:

Requirement

Description

Fin Voice

Fin Voice enabled and hosted in US, EU, or AU regions.

Admin Access

Required for both Intercom and Amazon to manage routing and API tokens.

Knowledge Base

Up-to-date Help Center content for Fin to reference.

Intercom Access Token

A valid access token (API Key) is required to authenticate the Lambda function script.

AWS Environment

An active Amazon Connect instance with permissions to create Lambda functions and Contact Flows.


1. Test Fin Voice

Before going live, use the Voice Testing tab to simulate calls in your browser.

  1. Click Play and start speaking to hear Fin's responses.

  2. Use Settings (top right) to switch voices or preview greetings and escalation rules.


2. Create a Fin Voice line

To move from testing to a live line, you must purchase a dedicated number within Intercom.

  1. Click + New line.

  2. Select External Provider and click Next.

  3. Name your line, select From a phone number (PSTN), and click Next.

  4. Click Purchase to acquire a US local number.


3. Configure recordings and behavior

Enable Context Tools

To allow teammates to see what happened during the AI portion of the call, enable global settings:

  1. Switch on Enable recordings, Transcripts, and Call transcription summaries.

  2. Return to the Fin AI Agent > Deploy > Phone > Set Fin live section, from here you can adjust how Fin behaves:

  • Office hours: Define when Fin should answer (defaults to 24/7).

  • Voice and language: Choose a voice that fits your brand.

  • Support content: Select which Help Center articles Fin should reference.

  • CSAT: Enable keypad ratings (1–5) for resolved calls.


4. Create the Lambda function

You must create a Lambda function in AWS to register the call with Fin Voice. This function returns a fin_intent_id required for the transfer.

  1. In your AWS Console, navigate to Lambda and click Create function.

  2. Select Author from scratch.

  3. Enter a function name (e.g., intent_to_use_fin).

  4. For Runtime, select Node.js 18.x (or higher).

  5. Under Configuration > Environment variables, add a new variable:

    • Key: INTERCOM_TOKEN

    • Value: Your actual Intercom Access Token.

  6. Under Code, paste the following script. This sends call details to Intercom's API and returns a fin_intent_id required for the transfer.


export const handler = async (event) => {
const contactId = event?.Details?.ContactData?.ContactId;
const phoneNumber = event?.Details?.ContactData?.CustomerEndpoint?.Address;

if (!contactId || !phoneNumber) {
throw new Error("Missing contactId or phoneNumber");
}

const token = process.env.INTERCOM_TOKEN;
if (!token) throw new Error("Missing INTERCOM_TOKEN");

const response = await fetch("https://api.intercom.io/fin_voice/register", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Intercom-Version": "Unstable",
"Content-Type": "application/json",
},
body: JSON.stringify({
call_id: contactId,
phone_number: phoneNumber,
}),
});

const text = await response.text();
if (!response.ok) {
throw new Error(`Intercom ${response.status}: ${text}`);
}

const data = JSON.parse(text);

return {
fin_intent_id: String(data.id),
customer_phone: phoneNumber,
};
};

Tip: If your Lambda invocation fails silently in the next step, ensure you have added the Lambda function to your Amazon Connect instance via the AWS Console (Amazon Connect > Instances > [Your Instance] > Contact Flows > AWS Lambda).


5. Configure the Amazon Connect Flow

Once your Lambda function is ready, you need to add it to your Amazon Connect Flow to handle the handoff. You must wire your Contact Flow in a specific order to avoid call failures.

The canonical flow

Your flow must follow this exact sequence:

  1. Entry

  2. Play greeting

  3. Invoke AWS Lambda function (Sync)

  4. Play prompt (Short delay)

  5. Transfer to phone number

  6. End flow

Step-by-step configuration

  1. Add the Invoke AWS Lambda function block

    • Function ARN: Select the Lambda function created in Step 4.

    • Timeout: Set to 8 seconds.

    • Response Validation: Select String Map.

  2. Add the Play prompt block (Required Delay) Fin Voice ignores DTMF signals sent too early. You must add a delay immediately before the transfer.

    • Add a Play prompt block.

    • Select Text-to-speech and enter a short phrase like "Please hold for a moment."

  3. Add the Transfer to phone number block This block hands the call off to Fin.

    • Transfer to: Select Set manually.

    • Country code: Select your country (e.g., United States +1).

    • Phone number: Enter the dedicated Fin Voice number purchased in Step 2.

    • Resume flow after disconnect: Set to No.

    • Send DTMF: Check this box.

      • Select Set dynamically.

      • Namespace: External

      • Key: fin_intent_id

    • Caller ID number: Select Set manually and choose a verified number from your Connect instance.

Important:Do not use "Set dynamically" for the Caller ID if you have selected a manual number. Mixing these methods will cause the transfer to fail.


6. Handle post-Fin routing

If Fin transfers the call back to Amazon Connect (e.g., for a human agent), you can use a second Lambda function to retrieve conversation details.

  1. Create a new Lambda function using the code below.

  2. Add it to your flow after the Transfer to phone number block (specifically the "Success" branch if you enabled "Resume flow").


export const handler = async (event) => {
const phoneNumber = event?.Details?.ContactData?.CustomerEndpoint?.Address;

const response = await fetch(
`https://api.intercom.io/fin_voice/phone_number/${phoneNumber}`,
{
method: "GET",
headers: {
Authorization: `Bearer ${process.env.INTERCOM_TOKEN}`,
"Intercom-Version": "Unstable",
Accept: "application/json",
},
}
);

if (!response.ok) {
throw new Error("Failed to retrieve Fin Voice call state");
}

const data = await response.json();
return {
status: data.status,
intercom_conversation_id: data.intercom_conversation_id,
call_summary: data.call_summary,
};
};


7. Add conversation summary to Connect UI

To ensure teammates see the AI-generated summary when they accept a call, you must configure a View in Amazon Connect.

Create the view

  1. Navigate to the Views interface in Amazon Connect and click Create View.

  2. Search for and select the Attribute Bar component.

  3. Configure the attribute bar properties:

    • Label: Set to "Conversation Summary".

    • Value: Set to $.conversation_summary.

Create the view flow

  1. Create a new Flow to display this view to the customer or teammate.

  2. Add a Show View block to the flow.

  3. Set the View property to the view you created in the previous step.

  4. Set the Timeout to Set manually and enter 5 minutes (or your preferred duration).

  5. Under conversation_summary, select Set dynamically:

    • Namespace: External

    • Key: conversation_summary

Connect the flow to the agent

  1. Return to your original IVR flow (where you configured the transfer).

  2. Before the Transfer to queue block (where the call routes to a teammate), add a Set event flow block.

  3. Configure the block settings:

    • Select event: Default flow for Agent UI.

    • Select a flow: Choose the "Show View" flow you just created.

  4. Connect this block to your Transfer to queue block.

This configuration ensures that when the call transfers, the teammate sees the "Conversation Summary" bar populated with data from Fin.


💡Tip

Need more help? Get support from our Community Forum
Find answers and get help from Intercom Support and Community Experts


Did this answer your question?