> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cekura.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentforce Integration

> Connect a Salesforce Agentforce agent to Cekura for chat testing, inbound voice testing, and automatic import of Agentforce Voice calls.

## Overview

Connect Agentforce to Cekura to run chat evaluations against your agent, test your Agentforce Voice agent by calling its phone number, and monitor production Agentforce Voice calls automatically.

> [!NOTE]
>
> Cekura cannot start outbound calls from an Agentforce Voice agent. For voice testing, Cekura calls your agent's inbound phone number.

## Prerequisites

* An Agentforce agent and its Agent ID
* A Salesforce External Client App with the Client Credentials Flow enabled
* Your Salesforce My Domain URL, for example `https://example.my.salesforce.com`
* For voice: an Agentforce Voice phone number

## Set up the External Client App in Salesforce

**1. Add OAuth scopes**

In **Setup → External Client App Manager**, open your app and edit its OAuth settings. Add these scopes:

* Manage user data via APIs (`api`)
* Perform requests at any time (`refresh_token`, `offline_access`)
* Access chatbot services (`chatbot_api`)
* Access the Salesforce API Platform (`sfap_api`)

Enable **Client Credentials Flow** and **Issue JSON Web Token (JWT)-based access tokens for named users**, then save.

**2. Set the Run As user**

On the app's **Policies** tab, enable **Client Credentials Flow** and set **Run As** to a dedicated integration user.

**3. Connect the app to your agent**

In **Setup → Agentforce Agents**, open your agent, go to **Connections**, add an **API** connection, and select the External Client App.

**4. Grant voice call access**

To import Agentforce Voice calls, give the Run As user read access to **Voice Calls**, **Voice Call Recordings**, and conversation entries. Turn on call recording in your Agentforce Voice setup if you want Cekura to import recordings.

> [!NOTE]
>
> Salesforce can take a few minutes to apply changes to an External Client App.

## Connect Agentforce in Cekura

In Cekura, go to **Agents**, create an agent, and select **Agentforce** as the provider.

![Select Agentforce as the agent provider in Cekura](https://mintcdn.com/vocera/lkl6owxj8I4OLZEy/images/agentforce/select-provider.png?fit=max\&auto=format\&n=lkl6owxj8I4OLZEy\&q=85\&s=f77f0cfa179aba1d4645db47238d5d28)

Enter the following and save the agent:

| Field | Value |
| - | - |
| **Agentforce Client ID** | The External Client App's consumer key |
| **Agentforce Client Secret** | The External Client App's consumer secret |
| **Agentforce Domain** | Your My Domain URL, without a trailing slash |
| **Agentforce Agent ID** | The ID of your Agentforce agent |

![Agentforce integration settings in Cekura](https://mintcdn.com/vocera/lkl6owxj8I4OLZEy/images/agentforce/integration-settings.png?fit=max\&auto=format\&n=lkl6owxj8I4OLZEy\&q=85\&s=5bb1c1fa34020b82685391bb96f2c57a)

## Chat testing

Open an evaluator, click **Run**, select **Chat** under **Connections**, and start the run. Cekura starts an Agentforce session for each conversation and records the transcript and metrics in the result.

![Configure Run dialog with Agentforce chat selected](https://mintcdn.com/vocera/lkl6owxj8I4OLZEy/images/agentforce/configure-run-chat.png?fit=max\&auto=format\&n=lkl6owxj8I4OLZEy\&q=85\&s=3dde9fcd115d4d343fb395d466d03095)

See [Chat Testing](https://docs.cekura.ai/documentation/integrations/chat-testing.md) for more details.

## Voice testing

To test your Agentforce Voice agent, enter its phone number under **Telephony Settings**, keep **Inbound** enabled, and save the agent. Run an evaluator using the **Telephony** connection, and Cekura calls the agent's number for each test.

![Agentforce telephony settings in Cekura](https://mintcdn.com/vocera/lkl6owxj8I4OLZEy/images/agentforce/telephony-settings.png?fit=max\&auto=format\&n=lkl6owxj8I4OLZEy\&q=85\&s=95e8591de162e5c7d2539b1d2e2a346d)

## Monitor production calls

Enable **Auto-fetch Calls** in the Agentforce provider settings to import completed Agentforce Voice calls automatically.

**1. Configure the phone number**

Enter the Agentforce Voice phone number under **Telephony Settings**. Cekura imports only calls made to or from this number.

**2. Enable Auto-fetch Calls**

Turn on **Auto-fetch Calls** and save the agent.

![Enable Agentforce production call auto-fetch in Cekura](https://mintcdn.com/vocera/lkl6owxj8I4OLZEy/images/agentforce/auto-fetch-production-calls.png?fit=max\&auto=format\&n=lkl6owxj8I4OLZEy\&q=85\&s=6dcd9e3ae9a1a38110ca0cf94748e570)

**3. Review imported calls**

Open **Calls** in Cekura to review each call's transcript, recording, duration, end reason, and metric results.

![Imported Agentforce Voice call with transcript and recording](https://mintcdn.com/vocera/lkl6owxj8I4OLZEy/images/agentforce/imported-call.png?fit=max\&auto=format\&n=lkl6owxj8I4OLZEy\&q=85\&s=89f8d33b8422db48803589d8db43ea06)

> [!NOTE]
>
> If a call has no recording in Salesforce, or the Run As user cannot read it, Cekura still imports the transcript and call details.

## Troubleshooting

* **`invalid_grant: no valid scopes defined`**: the External Client App has no OAuth scopes. Add the scopes listed above and enable the Client Credentials Flow.
* **No calls are imported**: check that the phone number in Cekura matches the Agentforce Voice number, and that the Run As user can read Voice Calls.
* **Calls import without recordings**: turn on call recording in your Agentforce Voice setup and give the Run As user access to Voice Call Recordings.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.