# Salesforce Service Cloud

{% hint style="info" %}
This integration requires assisted setup. Contact the Alhena team to get started, then follow the steps below.
{% endhint %}

This guide will help you set up the Alhena integration with your Salesforce organization. We offer two integration options:

1. **Email Cases Integration** - Bidirectional email support between Salesforce Cases and Alhena
2. **Messaging Integration** - Real-time agent messaging in the Salesforce Service Console

You can set up one or both integrations based on your needs.

***

### Prerequisites

* Salesforce org with **System Administrator** access
* Email-to-Case enabled (for Email Cases integration)
* Embedded Service Deployments configured (for Messaging integration)

**Time Required:**

* OAuth Setup (Required for both): \~10 minutes
* Email Cases Integration: \~15 minutes
* Messaging Integration: \~15 minutes

***

## Part 1: OAuth Setup (Required for Both Integrations)

This OAuth configuration is required whether you're setting up Email Cases, Messaging, or both integrations.

### Steps to Complete

#### Step 1: Create OAuth Connected App

1. **Setup → Apps → External Apps → External Client App Manager**
2. **New External Client App**
3. **Basic Information:**
   * **External Client App Name**: `Alhena Integration`
   * **API Name**: `Alhena_Integration`
   * **Contact Email**: Your email address
4. **API (Enable OAuth Settings):**
   * ✅ **Enable OAuth Settings**
   * **Callback URL**:
     * US region: <https://app.alhena.ai/external_integrations/salesforce_oauth_callback>
     * EU region: <https://eu.alhena.ai/external_integrations/salesforce_oauth_callback>
   * **Selected OAuth Scopes**:
     * **Full access** (full)
     * **Perform requests at any time** (refresh\_token, offline\_access)
5. **Security Settings:**
   * ❌ **Uncheck** "Require Secret for Web Server Flow"
   * ❌ **Uncheck** "Require Secret for Refresh Token Flow"
   * ✅ **Enable Client Credentials Flow**
   * ✅ **Enable Authorization Code and Credentials Flow**
6. **Click Save**
7. **After saving, click "Manage Consumer Details"**
8. **Send these to your Alhena contact:**
   * **Consumer Key** (Client ID)
   * **Consumer Secret** (Client Secret)
   * **Salesforce Instance URL** (e.g., `https://yourorg.my.salesforce.com`)

***

## Part 2: Email Cases Integration

Enable bidirectional email support between Salesforce Cases and Alhena AI.

### What You'll Need to Provide to Alhena

Before starting, please send the following information to your Alhena contact:

1. **Bot User Email** - The email address of the Salesforce user that will handle AI responses (e.g., `bot@yourcompany.com`) Default it is set to <no-reply-gleen-bot@gleen.ai>. If you'd like to use a custom address, let the Alhena team know.
2. **Sender Email** - The Organization-Wide Email Address for AI replies (e.g., `support@yourcompany.com`)
3. **Escalation Queue Name** (Optional) - The name of your Salesforce Queue for human handoff

### Steps to Complete

#### Step 1: Create Bot User

1. **Setup → Users → New User**
2. **Configure the user:**
   * **Email**: `bot@yourcompany.com` (or your chosen bot email)
   * **Profile**: Standard User or Custom Profile with Case access
   * **User License**: Salesforce or Salesforce Platform
3. **Save and activate the user**

#### Step 2: Configure Email-to-Case

Ensure your Email-to-Case is configured to route cases to your bot user. You will also need Org-Wide Email configured in Salesforce for the email you'd like to send from (usually the same as the Email-to-Case address).

#### Step 3: Deploy Alhena Package

Alhena will provide you with a deployment package (`AlhenaEmailCaseWebhook.zip`).

1. **Go to** [**https://workbench.developerforce.com/**](https://workbench.developerforce.com/)
2. **Login to your Salesforce org**
3. **Navigate to Migration → Deploy**
4. **Upload `AlhenaEmailCaseWebhook.zip`**
5. ✅ **Check "Single Package"** (Required!)
6. ✅ **Check "Run All Tests"** (Required for production orgs)
7. **Click Deploy**
8. **Wait for deployment to complete**

#### Step 4: Notify Alhena Team

Contact your Alhena representative to let them know the package has been successfully deployed.

**Optional - Escalation Queue:**

If you want to use a human escalation queue for handoffs, provide the **name** of your escalation queue in Salesforce.

***

## Part 3: Messaging Integration

Enable real-time agent messaging in the Salesforce Service Console. (Optional)

If you do not require live chat with human agents, Alhena can configure your integration to create email cases inside of Salesforce Service Cloud instead.

### What You'll Need to Provide to Alhena

Please send the following information to your Alhena contact:

1. **Organization ID** - From Embedded Service Deployment
2. **Messaging Developer Name** - From Embedded Service Deployment

### Steps to Complete

#### Step 1: Get Embedded Service Deployment Details

If you already have an Embedded Service Deployment configured, locate it to get the required details.

**To create a new deployment:**

1. **Setup → Embedded Service Deployments**
2. **Click "New Deployment"**
3. **Configure the basic settings:**
   * **Deployment Name**: `Alhena Messaging Integration`
   * **Developer Name**: `Alhena_Messaging_Integration`
   * Complete the wizard with your preferred settings
4. **Save the deployment**

**Send these two values to your Alhena contact:**

* **Organization ID**: Found in the deployment details
* **Messaging Developer Name**: The Developer Name you set above (e.g., `Alhena_Messaging_Integration`)

#### Step 2: Deploy Alhena Package

Alhena will provide you with a deployment package (`AlhenaMessagingWebhook.zip`).

1. **Go to** [**https://workbench.developerforce.com/**](https://workbench.developerforce.com/)
2. **Login to your Salesforce org**
3. **Navigate to Migration → Deploy**
4. **Upload `AlhenaMessagingWebhook.zip`**
5. ✅ **Check "Single Package"** (Required!)
6. ✅ **Check "Run All Tests"** (Required for production orgs)
7. **Click Deploy**
8. **Wait for deployment to complete**

#### Step 3: Notify Alhena Team

Contact your Alhena representative to let them know the package has been successfully deployed.

***

### Need Help?

If you encounter any issues during setup, please contact your Alhena representative.

It's helpful to include:

* Screenshots of any error messages
* Which step you're currently on

We're here to help!

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alhena.gitbook.io/docs/integrations/helpdesk/integrating-alhena-with-saleforce-service-cloud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
