Integrate Flex with Salesforce
With out-of-the-box support for Salesforce Open CTI, you can now power your Salesforce environment with omnichannel communications offered by Flex. Both Salesforce Classic and Lightning Experience integrations are supported, allowing you to use Flex directly within your Salesforce instance.
In this guide, you will learn how to configure Flex within Salesforce, configure outbound calling, enable SSO (Single Sign-On), and launch your integration.
Let's get started!
Need to create a new Salesforce organization for your proof of concept? Create a Salesforce developer account at https://developer.salesforce.com.
The Flex Salesforce integration embeds the Flex agent user interface directly into the Salesforce application and creates a single source of truth for agents.
As part of the Salesforce integration, the following features are supported within Flex:
- Native Digital Engagement: supported interaction with customers on various communications APIs, such as Voice, Web Chat, SMS, and WhatsApp
- Personalization: route any Salesforce Object (case, lead, contact, or other custom object) and blend it with other channels
- Programmability: tailored look and feel of the application, possibility to code in adjustments
- Pre-built native features: click-to-dial, screen pop with search capabilities, context switching, activity logging, SSO integration
- Multiple deployment scenarios: Flex can be embedded inside of Salesforce, or Salesforce can be embedded within Flex
Start by configuring your Flex-Salesforce Integration by navigating to the Integrations section in your Flex Admin view.
The following parameters are required for the configuration:
|Are you planning to use SSO for this integration?||
Select this option if you want to deploy the Flex-Salesforce Integration using Single Sign-On (SSO).
Always check this option if you are operating in a production environment.
Leave this unchecked if you are planning to test the integration using your Twilio Account/Project login credentials.
(Optional) If you want to use a different Workflow than the default Workflow, please supply the Workflow SID here. If not, leave it empty. If you are not sure what this is, then leave it empty
|Task Channel SID||
(Optional) If you want to use a different Task Channel than the default Voice Channel, please supply the Task Channel SID here. If not, leave it empty. If you are not sure what this is, then leave it empty.
|Agent Caller ID||(Required) This will be the caller ID used for outbound calls from the Flex-Salesforce Integration (via Click-to-Dial) if an agent does not have a defined caller ID.|
|Salesforce Base URL||(Required) Register your Salesforce domain(s) on the Flex Settings page in the Twilio Console. For more details, refer to Securely iframe Flex in your application.|
Once you've configured your Salesforce instance, click "Download" under the Files section to view the Call Center Definition file to be used in your Salesforce Call Center configuration.
Protip: you can right click and save the link to download the XML file directly!
Different Call Center Definition Files are generated depending upon whether you choose to use SSO or not. If you indicated that you are planning to use SSO during the configuration step, you must update the "CTI Adapter URL" in your Call Center Definition file. Your file will contain: https://flex.twilio.com/yourRuntime-Domain-3869?path=/agent-desktop.
Update "yourRuntime-Domain-3869" to match your Twilio Flex Login Link. You can find this Login Link on the SSO Configuration page within the Twilio Console.
Import the Flex Call Center Definition file
- Log into your Salesforce org
- In the top right of your Salesforce view, click Setup
- In the left-hand search box, search for “Call Center.” Select Call Centers.
- Click Import to import your Call Center Definition file (you should have downloaded a single HTML file.)
- You should now see the Call Center Definition you just imported:
Add users to your newly-imported Call Center
Add users to your newly-created Flex Call Center on Salesforce by clicking on Manage Call Center Users. You may need to renavigate to this page for the option to appear.
Once you have finished adding users, you should see a screen that looks like this:
Configure the Salesforce Softphone layout
1. Under Call Center in the left-hand search bar, click on Softphone Layouts.
2. Set your Screen Pop Settings to the following values:
- Screen Pops open within: New browser window or tab
- No matching records: Pop to new Contact
- Single-matching record: Pop detail page
- Multiple-matching record: Pop to search page
Configure Salesforce for Open CTI
Add your Softphone to your utility bar in Salesforce Lightning Experience by following these steps:
Go to Setup, then search for "App Manager." Select App Manager.
Select the App you want Flex to appear in (e.g., Sales Console), and click Edit in the dropdown menu.
Go to Utility Items
Add Open CTI Softphone to your list of Utility Items.
Configure the Open CTI Softphone with the below values:
For your Proof-of-Concept, MVP, or development project, you can use your Twilio credentials to log in as an admin via the Flex login screen.
For any Production implementation, you might want to configure Single Sign-On with Twilio Flex by integrating your Identity Provider. See this guide to learn more about configuring SSO for Flex.
Make sure you define a worker attribute
callerId through your SSO setup. We recommend defining a default outbound Caller ID as described above.
Launch your Flex-Salesforce integration in Lightning
- While logged into Salesforce, click on the App Launcher and go to the application that you've configured with Open CTI.
- Find Twilio Flex in the bottom left corner of the screen and click on it.
- You will be prompted to log in:
- Once logged in, you will have Twilio Flex inside of Salesforce Lightning Experience, ready to use!
Launch with Flex <> Salesforce Integration in Classic
- Log into your Salesforce account.
- Click on the App Launcher and select the Console application that you configured with Open CTI
- Find Twilio Flex in the bottom right corner of the screen and select it.
- Log into Flex.
- Once logged in, you will have Twilio Flex inside of Salesforce Classic, ready to use!
That's it! See our guide on Call Flows to take it for a spin.
- Copy Download Link feature does not work in Flex Insights when Flex is embedded within Salesforce
- When making an outbound call, ensure the relevant Salesforce record for the phone number is open before beginning the call. Otherwise, activity logs of the outbound call may not be reflected on the correct Salesforce record.
Third Party Cookies
Agents must include third party cookies in their browser in order for Flex to integrate smoothly with Salesforce.
Outbound call log
Agents must search for the Salesforce record of the relevant phone number before beginning an outbound call. This is to ensure the outbound call will be logged to the correct Salesforce record.
Now that you've integrated Flex with your Salesforce instance, learn more about customizing your integration and managing interactions with your users:
- Learn how to manage your Flex-Salesforce call flows
- Customize your Flex-Salesforce integration
- Check out the release notes for a complete list of supported features
- Securely embed Flex as an iframe
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.