AWS Contact Center

Enable agent to agent calling as a third-party (3P) application in Amazon Connect agent workspace

In collaborative contact center environments, the ability for agents to connect directly with each other can significantly improve productivity and streamline problem resolution. Whether it’s transferring contextual information, requesting supervisor assistance, or collaborating across teams, agent-to-agent calling plays a crucial role in enhancing internal communication.

Amazon Connect provides the flexibility to build such features using its native capabilities and extensibility. In this blog, we’ll explore how to implement agent-to-agent calling using AWS services and integrate it directly into the Amazon Connect agent workspace as a third-party (3P) application.

This solution provides agents with a lightweight, user-friendly interface to:

  • Search for and initiate calls to other agents
  • View availability of agents (optional enhancement)
  • Simplify internal collaboration through a single unified workspace

By the end, you’ll have a simple, scalable architecture that allows internal agent communications to happen just as smoothly as customer calls.

Architecture overview:

  1. Amazon Connect streams data: CTRs and agent events are streamed via Amazon Kinesis
  2. Lambda Function: Handles lookup of agent routing profiles and phone numbers.
  3. Amazon Connect Contact Flows: Configured to route internal agent calls.
  4. API Gateway: A secure API is created to provide visibility of reviewing peer agent status and ability to make direct calls to available agents.
  5. React JS 3P App: A React JS widget is embedded into the Agent Workspace to display the list of peer agents and availability status.

Prerequisites

Before you get started, make sure you have:

Walkthrough

This solution leverages AWS-native services — Amazon Connect, Lambda, DynamoDB, API Gateway, and AppSync — along with a React-based 3P app to integrate directly into the agent workspace.

  1. Presence Management: Agent availability data is stored in DynamoDB and accessed through AppSync APIs managed by a Lambda resolver.
  2. Internal Call Routing: A dedicated Amazon Connect Contact Flow handles internal transfers between agents using “Transfer to Phone Number” or “Transfer to Agent” blocks.
  3. Call Initiation via API Gateway: A secure REST API (backed by Lambda) allows the React app to initiate an internal call by invoking the contact flow with the target agent’s ID.
  4. Workspace Integration: A React widget embedded into the Amazon Connect Agent Workspace provides an intuitive UI for searching agents and initiating calls, with optional presence indicators.

Figure 1. Architecture Diagram

Steps to be detailed

Step 1: Create an Agent Presence DynamoDB table

  • In the AWS Management Console, navigate to DynamoDBTablesCreate Table.
  • Set the Table name to AgentPresenceTable.
  • Set the Partition key to PK (String) and the Sort key to Login (String).
  • Leave other settings default and click Create.
{
 "PK": "<BUSINESS_UNIT_NAME_TO_GROUP_AGENTS>",
 "Login": "<CONNECT_USER_ID>",
 "AgentARN": "arn:aws:connect:us-east- 1:<ACCT_NAME>:instance/<INSTANCE_NAME>/agent/<AGENT_ID>",
 "AgentStatus": "<CURRENT_AGENT_STATUS>",
 "FirstName": "<FIRST_NAME>",
 "LastName": "<LAST_NAME>",
 "StartTimestamp": "<TIME_STAMP_OF_RECORD_CREATION" 
}

Step 2: Create an “agent status management” AWS Lambda function using AWS AppSync

  • Go to AWS Lambda → Create Function → Author from scratch.
  • Function name: AgentStatusLambda.
  • Runtime: Node.js 18.x.
  • Click Create function.
  • Add the following code:.
const AWS = require('aws-sdk'); 
const ddb = new AWS.DynamoDB.DocumentClient();</code><code class="lang-json"> </code><code class="lang-json"> const</code><code class="lang-json"> tableName = process.env.TABLE_NAME; 
exports.handler = async (event) =&gt; { 
 const { fieldName, arguments } = event; 
 if (fieldName === 'getAgentStatus') { 
  return await ddb.get({ TableName: tableName, Key: { PK: arguments.PK, Login: arguments.Login } }).promise(); }

 if (fieldName === 'updateAgentStatus') { 
  await ddb.put({ TableName: tableName, Item: arguments }).promise(); 
  return { success: true }; 
 } 
};
  • Under Configuration → Environment Variables, add:
    • TABLE_NAME = AgentPresenceTable

This Lambda function will handle agent presence status operations through AWS AppSync.

  1. The function routes incoming AppSync requests to specialized handlers based on the fieldName parameter.
  2. Operations include reading and updating agent availability data in DynamoDB.

Step 3: Set up internal call flow in Amazon Connect

  • Open Amazon Connect → Routing → Contact flows → Create contact flow.
  • Name it InternalAgentCallFlow.
  • Add the following blocks:
  • Get customer input
  • Invoke AWS Lambda function
  • Transfer to Agent
  • Configure the Lambda to look up the destination agent and connect calls.
  • Save and publish the contact flow.

Step 4: Create Lambda for call initiation

  • Go to AWS Lambda → Create Function and name it InitiateAgentCall.
  • Runtime: Node.js 18.x.
  • Add the following code:
const AWS = require('aws-sdk'); 
const connect = new AWS.Connect();

exports.handler = async (event) => { 
  const params = { 
   InstanceId: process.env.INSTANCE_ID, 
   ContactFlowId: process.env.CONTACT_FLOW_ID, 
   SourcePhoneNumber: process.env.SOURCE_NUMBER, 
   DestinationPhoneNumber: event.targetAgentNumber 
 };

 await connect.startOutboundVoiceContact(params).promise(); 
 return { message: 'Call initiated successfully' }; 

};
  • Under Configuration → Environment Variables, add:
    • INSTANCE_ID
    • CONTACT_FLOW_ID
    • SOURCE_NUMBER

Step 5: Expose API with API Gateway

  • 1. Go to API Gateway → Create API → REST API → New API.
  • 2. Name it AgentCallAPI.
  • 3. Create a POST method under /initiateCall.
  • 4. Integration type: Lambda Function, and select InitiateAgentCall.
  • 5. Deploy the API to a new stage (e.g., prod).
  • 6. Copy the Invoke URL to use in the React app.

Step 6: Build a 3P app for the agent workspace

  • . Open your terminal and run:
    • npx create-react-app agent-caller-widget
    • cd agent-caller-widget
    • npm install axios
  • Replace the contents of src/App.js with the following example:
import axios from 'axios';
function AgentList({ agents }) {
 const initiateCall = (agentId) => {
  axios.post('https://<api-id>.execute-api.us-east- 1.amazonaws.com/prod/initiateCall', { agentId }); 
 };
 return (
  <div>
   {agents.map(a => (
    <div key={a.Login}>
    {a.FirstName} {a.LastName}
    <button onClick={() => initiateCall(a.Login)}>Call</button>
   </div>
  ))}
  </div>
 );
 }
 export default AgentList;

Step 7: Embed the 3P app into the agent workspace

  • Go to Amazon Connect → Agent applications → Third-party apps → Add new app.
  • App name: Agent Caller.
  • URL: Paste the hosted React app URL (from S3 or CloudFront).
  • Add permissions for API access and DynamoDB read/write as needed.
  • Save and verify that the app loads inside the Agent Workspace.

Cleaning up

Once you’ve tested and validated the Agent to Agent Calling integration, it’s important to clean up unused AWS resources to prevent ongoing charges. Below are the components you may want to delete:

  • DynamoDB table
    • Navigate to the DynamoDB console
    • Locate the table created to store events
    • Select it and choose Delete table
  • Agent Status Lambda function
    • Go to the Lambda console.
    • Find and delete the Lambda function.
  • call initiation Lambda function
    • Locate and remove the Lambda function that served call initiation.
  • API Gateway
    • In the API Gateway console, identify the API created to expose agent to agent calling.
    • Delete the API to prevent any further external calls and usage charges.
  • Custom Amazon Connect contact flows
  • React JS 3P widget in the agent workspace
    • Navigate to the Amazon Connect console.
    • Under Agent Application Settings, remove the 3P app (React widget) from the workspace configuration.
  • IAM roles & permissions
    • Review any IAM roles created for the Lambda functions, API Gateway, or DynamoDB.
    • Detach unnecessary policies or delete unused roles to maintain a clean IAM setup.

Conclusion:

Agent-to-agent calling in Amazon Connect bridges communication gaps and enhances agent collaboration without needing external tools or additional infrastructure.

This version focuses on search and transfer capabilities, providing a simple and secure way for agents to connect internally. Using AWS-native services ensures flexibility, scalability, and a strong foundation for future enhancements such as presence awareness, internal call analytics, and real-time reporting.


About the authors

Agnel Joseph is a Senior AWS Professional Services consultant in Amazon Connect and cloud-native contact center modernization. Agnel helps enterprises design and deploy scalable, resilient, and intelligent agent experience platforms. He is a technologist and student who loves learning and creating new Solutions.
Thiru Subramanian is an AWS Professional Services consultant specializing in Amazon Connect, bringing 20+ years of expertise in the contact center space. He excels at transforming traditional enterprise call centers into Amazon Connect solutions, with a focus on creating customer-centric implementations and seamless integrations. Outside of professional pursuits, Thiru enjoys traveling and reading books.
Rama Krishna Yalla is an Associate Delivery Consultant at AWS, adept at designing scalable, reliable, and secure cloud environments. He leverages automation and CI/CD best practices to streamline software delivery, reduce downtime, and enhance operational efficiency. He specializes in Amazon Connect, where he helps customers implement and optimize cloud-based contact center solutions tailored to business needs. Outside of work, Rama enjoys playing badminton and often participates in local tournaments.

 

Satish Somasundaram is a Senior Amazon Connect Consultant at AWS. He provides thought leadership and guidance to customers on their Customer Experience transformation journey to Amazon Connect.

Swetha Tharvesanchi Mallikarjunais a Delivery Consultant at AWS Professional Services, specializing in application development and AI solutions. She helps enterprises build modern, scalable, user-focused applications using AWS services to deliver exceptional user experiences. With expertise in creating comprehensive solutions that drive business value. Outside of work, she enjoys spending quality time with her family.