Salesforce
Connect moinAI with Salesforce Case and Salesforce Enhanced Chat
With the Salesforce Case integration, requests collected by the Agentic AI are automatically created as tickets (Cases) in Salesforce. Qualified enquiries reach the customer service team without any manual handover. The Salesforce Enhanced Chat integration (also known as MIAW, Messaging for In-App and Web) hands over an ongoing conversation from the Agentic AI to service agents in Salesforce in real time.
Both Cases and the Salesforce live chat handover require configuration in Salesforce and a matching configuration in the moinAI Hub. Further platforms that can be connected in the moinAI Hub are described in General information: Integration.
With the fully integrated moinAI live chat, moinAI offers a ready-made platform that can be set up and managed directly in the Hub without a separate integration. For questions, the Customer Success Team is available at customersuccess@moin.ai.
- Salesforce Case: Create tickets automatically
1.1 Create an External Client App in Salesforce
1.2 Set assignment policies in Salesforce
1.3 Configure the Case integration in the moinAI Hub - Salesforce Enhanced: Live chat handover
2.1 Set up Omni-Channel and the service channel
2.2 Create a queue
2.3 Create an Omni-Channel flow
2.4 Create a messaging channel
2.5 Create an Embedded Service Deployment in Salesforce
2.6 Configure the Messaging integration in the moinAI Hub
2.7 Optional: Pre-chat attributes for data transfer
2.8 Set up Enhanced Chat in the Service Console - Integration into forms
1. Salesforce Case: Create tickets automatically
Use case
A customer has received a damaged parcel. Instead of writing an email, she opens the chat on the website. The Agentic AI asks for the order number, a short description of the damage and her email address. Thanks to the integration, moinAI takes this data and immediately creates a new Salesforce Case in the background. When the customer service team opens Salesforce in the morning, a complete, assigned ticket with all the customer's details is already waiting. The team can arrange a replacement straight away without entering any data manually.
Setting up the Salesforce Case integration requires administrator access to Salesforce. With these rights, an External Client App is set up. The Client ID and Client Secret come from this app and are entered in the moinAI Hub together with the Instance URL. The OwnerId is then added in the field mapping.
1.1 Create an External Client App in Salesforce
An External Client App in Salesforce secures the authentication between the moinAI Hub and Salesforce via OAuth.
- Open the settings in Salesforce.
- Search for App Manager in the search field of the sidebar and open it.
- Click New External Client App.
- Fill in the required fields (e.g. the name of the app). Salesforce generates the API name automatically without spaces.
- In the API (Enable OAuth Settings) section, select Enable OAuth.
- Enter the callback URL in the corresponding field (e.g.
https://bot.moin.ai/). - Under Selected OAuth Scopes, add the following permissions:
Manage user data via APIs (api)Perform requests at any time (refresh_token, offline_access)
- In the Flow Enablement section, select Enable Client Credentials Flow.
- Click Create to finish.
1.2 Set assignment policies in Salesforce
- Go to the Policies tab of the new app.
- In the OAuth Policies section, select Enable Client Credentials Flow.
- In the Run As (Username) field, select the Salesforce username of the person whose permissions are used to create the Cases.
Missing user assignment
If no active user is entered under Run As (Username) in the policies, the ticket transfer fails with the error "No client credentials user enabled." Usernames are shown via the profile picture in the menu Settings > Details > Username.
1.3 Configure the Case integration in the moinAI Hub
Once the access data in Salesforce is ready, set up the interface in the moinAI Hub. Go to Integrations > Salesforce and click Edit. Clicking Create Salesforce opens the configuration area. The settings for automatic ticket creation are made in the Case tab.
Important: Separate configuration for Case
If the live chat handover is also used, it needs its own configuration in the moinAI Hub, see Messaging integration. Only switch on the Enable Salesforce Case toggle in the Case configuration.
Enter authentication details
The data generated in Salesforce is entered in the corresponding fields.
To find the data in Salesforce, go to the Settings tab of the External Client App. Under OAuth Settings > App Settings, click Consumer Key and Secret. Copy the consumer key as the Client ID and the consumer secret as the Client Secret and keep them ready for the configuration in the moinAI Hub.
- Instance URL: Enter the domain URL of the Salesforce instance. It is shown in Salesforce under Setup > Domains as the My Domain URL (format
https://<domain>.my.salesforce.com). - Client ID: Paste the consumer key of the External Client App.
- Client Secret: Paste the consumer secret of the External Client App.

- Switch on the Enable Salesforce Case toggle to activate the integration.
- To let users upload documents or screenshots in the chat and attach them to the Case, two steps are needed:
- Switch on the Enable file upload toggle in the Case configuration.
- Add a File upload step to the form.
Uploading documents or screenshots in the chat and attaching them to the Case also requires additional settings in the Hub. The Customer Success Team at customersuccess@moin.ai activates these on request.
Field mapping
The Add Field and Use template buttons define which chat answers are written to which Salesforce ticket field (e.g. subject or description). After clicking Use template, further fields appear, including OwnerId. Enter the Salesforce ID of the user to whom new Cases are assigned. The ID is found via your profile picture > click on your name and is shown in the address bar of the browser. Optionally, map the RecordTypeId field to assign Cases to a specific record type. This requires a record type for Cases under Setup > Object Manager > Case > Record Types.
An overview of all available Salesforce fields is shown in Salesforce under Setup > Object Manager > Case > Fields & Relationships.

Pass on the conversation history and conversation link
moinAI system variables store the chat history or a direct link to the conversation in the moinAI Hub in Salesforce:
- Conversation history: The variable
{{user_message_history}}provides the history as formatted text and can, for example, be mapped to the description field in Salesforce. - Link to the conversation: To add a direct link to the conversation to the Case, enter a link with the structure
https://hub.moin.ai/chats/messaging/{{uniqueUserId}}in the setup.
Note: The variable nameuniqueUserIdis case-sensitive and must be written exactly as shown.
Click Deploy to save the details and complete the configuration.
2. Salesforce Enhanced: Live chat handover
Use case
It is 2 pm on a Tuesday. A customer is about to buy an espresso machine worth £700 but hesitates because of the warranty terms. He asks his question in the chat. The Agentic AI is set up to offer a handover for purchase questions and asks: "Would you like to chat live with one of our coffee experts?" The customer agrees. Thanks to the messaging configuration, the request appears immediately on a service agent's screen in Salesforce. She takes over the chat seamlessly and answers the question live. The sale is complete.
The integration of Salesforce Enhanced Chat (also known as MIAW, Messaging for In-App and Web) requires a routing infrastructure and an Embedded Service Deployment in Salesforce. The data from the Salesforce setup is then entered in the moinAI Hub.
2.1 Set up Omni-Channel and the service channel
Forwarding messages requires a basic configuration of the routing infrastructure in Salesforce. These steps are usually carried out by the internal Salesforce administrators, who then enter the data in the moinAI Hub.
Activate Omni-Channel
Omni-Channel is activated in Salesforce via Service Setup > Recommended Setup > Chat with Customers. This defines a chat queue, the agents' workload and the website domains concerned. The code snippet at the end of the wizard is not needed. The values for the moinAI Hub come from the code snippet in the Embedded Service Deployment.


Under Setup > Service Channels, a service channel with the following values must exist: Service Channel Name Messaging, Developer Name sfdc_livemessage, Salesforce Object Messaging Session. It usually exists already. If not, create it via Setup > Service Channels > New.
2.2 Create a queue
Create or check a queue under Setup > Users > Queues. Messaging Session must be listed under Supported Objects. The "Chat with Customers" wizard does not reliably assign this object.
2.3 Create an Omni-Channel flow
A dedicated Omni-Channel flow routes messaging requests correctly.
Go to Setup > Process Automation > Flows or Omni-Channel Home > Omni-Channel Flows, click New Flow and select Omni-Channel Flow.

Create flow variables
In the Manager tab, click New Resource to create each required variable.

Enter the API names (e.g. recordId) exactly as shown, including upper and lower case. The messaging channel uses recordId to pass information to the Omni-Channel flow.
| Variable | Resource | API name | Data type | Available for |
|---|---|---|---|---|
recordId |
Variable | recordId |
Text | Input |
reasonForNotRouting |
Variable | reasonForNotRouting |
Text | Output |
agentsOnline |
Variable | agentsOnline |
Number (0 decimal places) | Input and output |
queuePosition |
Variable | queuePosition |
Number (0 decimal places) | Input and output |
waitingTime |
Variable | waitingTime |
Number (0 decimal places) | Input and output |
userEmail |
Variable | userEmail |
Text | Input |
visitorName |
Variable | visitorName |
Text | Input |
The variables userEmail and visitorName are only needed if the matching pre-chat fields from the pre-chat section are used. The API name must match the flow variable name in the parameter mapping exactly.
Configure flow elements
Then add the individual elements to the flow:
- Add a Check Availability for Routing element:
- Label:
Check Agent Availability - Set input values: set Service Channel to
Messagingand check the enumeration forQueue. - Queue: select the required queue (e.g.
ChooseYourQueue). - Output resources: select Manually assign variables (advanced) and save the following assignments:
- Estimated Wait Time:
{!waitingTime} - Online Agents:
{!agentsOnline} - Queued Work Items:
{!queuePosition}
- Estimated Wait Time:
- Label:
- Add a Decision element:
- Label:
Decision Agents Availability - Decision logic: select Manually Set Conditions.
- Define paths / outcomes:
- Path No Agents: condition
All Conditions Are Met (AND)| resourceagentsOnline| operatorEquals| value0. - Path Agents Online: condition
All Conditions Are Met (AND)| resourceagentsOnline| operatorGreater Than| value0. - Default Outcome: keep the default setting.
- Path No Agents: condition
- Label:
- Add an Assignment element (on the No Agents path):
- Label:
No Agent Text - Assign variable value: variable
reasonForNotRouting| operatorEquals| valueNo Agents Online, please try again later.
- Label:
- Add a Route Work element (on the Agents Online and Default Outcome paths):
- Label:
Enhanced Chat - Set input values: How Many =
Single| Record ID Variable ={!recordId}| Service Channel =Messaging| Route To =Queue(select the corresponding<Queue ID>).
- Label:
- Click Save to save the flow and Activate to activate it.

- To adjust the presence status, add the Messaging channel to the selected channels of the agent status (e.g. "Available - Chat") under Setup > Presence Statuses.
Detailed instructions on setting up routing in Salesforce are available in the Salesforce guide to preparing your org and in the guide to adding Enhanced Chat to the Service Console.
2.4 Create a messaging channel
- Under Setup > Messaging Settings, activate Messaging and create a new channel of the type Enhanced Chat.
- Set the following routing values: Routing Type
Omni-Flow, Flow Definition = the Omni-Channel flow created before, Fallback Queue = the queue created before. - Confirm with Acknowledge and activate the transcript downloads at the bottom of the page.
Salesforce automatically creates a deployment during this step. This deployment is not a Custom Client and can be ignored. moinAI needs its own deployment of the type Custom Client, which is created in the next step.
2.5 Create an Embedded Service Deployment in Salesforce
An API-based Embedded Service Deployment in Salesforce generates the interface keys for the moinAI Hub.
- In Salesforce, use the search to open Embedded Service Deployments.
- Click New Deployment to start.
- Select Enhanced Chat as the channel type and confirm with Next.

- Select Custom Client as the deployment type and click Next.
- Fill in the Name and API Name fields and assign the messaging channel created before. Click Save to finish.
- In the Code Snippet block, click Install Code Snippet.

- Copy the values for
OrganizationId,DeveloperNameandUrlfrom the configuration block. These are needed for the configuration in the moinAI Hub.
- Click Publish at the top right to activate the deployment. After publishing, the status must show the type "API".
2.6 Configure the Messaging integration in the moinAI Hub
Once the connection values from the Salesforce code snippet are available, enter them in the moinAI Hub. Go to Integrations > Salesforce > Edit and select the Messaging tab.
Important: Separate configuration for the live chat handover
The live chat handover needs its own configuration in the moinAI Hub, separate from the Case integration. In this configuration, the Enable Salesforce Case toggle must be switched off.
All three values are in the code snippet of the Embedded Service Deployment:
- Salesforce Messaging URL: value
Url, formathttps://<org>.my.salesforce-scrt.com. - Organization ID: value
OrganizationId. Alternatively under Setup > Company Information. - Developer Name: value
DeveloperName, the API name of the Embedded Service Deployment.

Click Deploy to save the configuration. The configuration only becomes active once it is linked to a form.
2.7 Optional: Pre-chat attributes for data transfer
Context data from the Agentic AI can be passed to Salesforce so that live chat agents see the user's name and email address as soon as the conversation starts. By default, moinAI supports the fields _firstName (value from the system variable user_name) and _email (value from user_email), as well as the custom field visitorName, which contains the same value as _firstName.
Parameter mapping in the messaging settings
- In Salesforce, go to Setup > Messaging Settings and open the active channel.
- At the bottom of the page, create the required variables via Create a New Custom Parameter.
- In the Parameter Mapping section, link the variables to the Omni-Channel flow (e.g. parameter
visitorNameto flow variablevisitorName, or parameterEmailto flow variableuserEmail).
Make data visible to agents
- In the Object Manager, create a custom field on the Messaging Session object, e.g. "Messaging User Email", type Text.
- In the Omni-Channel flow, create the variable
userEmailas an input, named exactly as in the parameter mapping. - Add an Update Records element on Messaging Session with the condition Messaging Session ID =
recordIdand use it to fill the new field. - Save and activate the flow.
Activate pre-chat in the Embedded Service Deployment
- Open the API deployment via Setup > Embedded Service Deployments and select Edit Pre-Chat.
- Switch on the pre-chat feature.
- Under Visible Pre-Chat Fields, add the Email field.
- Optional: move custom fields to Hidden Pre-Chat Fields if they should be transferred in the background without being visible to users.

- Save the pre-chat settings and click Publish to publish the changed deployment again.
For in-depth questions about complex routing scenarios or multiple queues, the Customer Success Team is available at customersuccess@moin.ai.
2.8 Set up Enhanced Chat in the Service Console
Agents only see the full conversation once the Enhanced Conversation component is placed in the Service Console. The easiest way is after the first successful test chat: open Edit Page, add a Message tab and place the component there.
Each group of agents needs its own chain of deployment, messaging channel, flow and queue, as well as its own configuration in the moinAI Hub. Save the flow as a new flow, not as a new version. For complex routing scenarios, the Customer Success Team is available at customersuccess@moin.ai.
3. Integration into forms
The finished integration is then linked to a form. The Customer Success Team takes care of the linking. To do this, send the configuration described above and the form to be linked by email to customersuccess@moin.ai.
Then test the integration in the preview.
- For Case: In the preview, fill in and submit the form in the test chat. In Salesforce, check whether the ticket (Case) has been created in the corresponding dashboard with all submitted data and any attachments.
- For Messaging: At least one test person must set their status to "Available" in the Salesforce Service Console to check the routing of the conversation. Only publish the final version of the Agentic AI platform after a successful test.
After a successful test, publish the status of the Agentic AI platform in the Hub to make the changes live on the website.
Display the ticket number in the chat (for Case)
After the Case has been created in Salesforce, the ticket ID is returned to the Agentic AI and automatically stored in the variable {{salesforce_case_id}}.
Add the variable {{salesforce_case_id}} to the final response step of the form (e.g. "Thank you! Your ticket has been created with the ID {{salesforce_case_id}}.").

This is the internal, unique Salesforce ID, not the readable Salesforce case number (CaseNumber), because the Salesforce API response only provides the internal ID by default.
For questions, the Customer Success Team is available at customersuccess@moin.ai and advises on the design and implementation of the integration as well as on the technical differences between the Salesforce interfaces.