Skip to main content
Skip table of contents

OCP® Integration with Salesforce

Introduction

This guide provides step-by-step instructions on how to integrate OCP® with Salesforce. This integration enables a seamless transfer of chat conversations from OCP® to a Salesforce live agent.

Before configuring OCP® integration with Salesforce, make sure you have an active Salesforce account with the necessary administrative privileges, and access to the Application you wish to integrate.

Salesforce Configuration

  1. Create a Deployment:

    • Navigate to the deployment setup in Salesforce and create a new deployment.

    • Save the Deployment ID that is provided upon creation.

  2. Create a Queue:

    • Go to Service Setup by clicking the gear icon in the top right.

      sf_2_2.png

    • In the quick search, type Queue and create a new queue, or use an existing one.

      sf_12.png
    • Place the agents to the queue.

      sf_11.png
    • Ensure the agent's account is assigned to this queue

      sf_4_2.png

    • Create a rooting configuration for this queue.

  3. Create a Chat Button:

    • In Service Setup, search for Buttons and select Chat buttons and Invitations.

      sf_5_2.png

    • Create a new chat button, selecting Omni-Channel as the routing type and assigning the queue you created in the previous step.

      sf_9.png

    • After creation, locate the Button ID in the chat button code snippet. This is the ID string found inside the liveagent.showWhenOnline('YOUR_BUTTON_ID') function call:

      sf_10.png

  4. Retrieve Organization ID:

    • Go to Setup and click on Company Information from the left menu.

    • Here you will find the Organization ID.

      sf_6.png

  5. Retrieve Live Agent URL:

    • In Setup, search for Deployments.

      sf_7.png

    • Select your deployment and find the URL within the liveagent.init call in the deployment code snippet. Copy the base URL.

      sf_8.png

After completing these steps, you should have the following information:

  • Deployment ID

  • Organization ID

  • Button ID

  • Live Agent Base URL

OCP MiniApp Configuration

Within the OCP MiniApp where you want the chat transfer to occur, configure the Webchat Configuration under the Chat tab.

Webchat Configuration Fields:

  • Type: Select "Salesforce".

  • Live agent base url: The URL retrieved from your Salesforce deployment.

  • Deployment id: The ID from the deployment you created.

  • Organization id: The ID from your Salesforce company information.

  • Button id: The ID of the chat button you configured.

  • Language: The language for the chat session.

  • Displayed username (optional): The name to be displayed to the Salesforce agent.

  • No agent available message: Message to display when no agents are available. The default is "There is no agent available right now. Please contact us again later.".

  • Agent session ended message: Message to display when an agent ends the chat. The default is "The agent has ended the chat.".

  • Chat request failed message: Message to display if the chat request fails. The default is "Chat request failed to Salesforce. Reason:".

  • Position message: Message to inform the user of their queue position. The default is "You are in position:".

  • Estimated time message: Message to provide an estimated wait time. The default is "Estimated wait time:".

  • Prechat details: These details will only be visible on the agent's side if the corresponding fields have been set up in the Chat Transcript object in Salesforce.

sf_1.png

All of these fields can utilize OCP variables using the pattern {{ocpvars:variableName}}.

After configuring the Webchat, go to the Orchestrator to create your application logic. Add a Transfer dialog control as the final step in your diagram to initiate the transfer to a live agent.

image-20250820-164226.png

Retrieving Chat History

To retrieve the chat history, you will need to make an API call to the following endpoint:

Method

Endpoint

GET

https://{...}.ocp.ai/chat/dialogs/history

The sessionId must be provided as a query parameter. For example: https://{...}.ocp.ai/chat/dialogs/history?sessionId=8ba5fe99-b90a-438c-99c6-8f85aa491770

Authorization

There are two methods for authorization:

  1. Bearer Token (JWT): The standard token used by other OCP services.

  2. Personal Access Token: This token must be included in the request header as X-OCP-PERSONAL-ACCESS-TOKEN.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.