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

Solution features

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

Configure Flex

Start by configuring your Flex-Salesforce Integration by navigating to the Integrations section in your Flex Admin view.

Flex Salesforce Integration

The following parameters are required for the configuration:

Parameter Name Description
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.

Workflow SID

(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:

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.

Configure Salesforce

Import the Flex Call Center Definition file

  1. Log into your Salesforce org
  2. In the top right of your Salesforce view, click Setup
    Go to Salesforce Setup
  3. In the left-hand search box, search for “Call Center.” Select Call Centers.
    Salesforce: Navigate to 'Call Centers'
  4. Click Import to import your Call Center Definition file (you should have downloaded a single HTML file.)
    Salesforce: Import call definition file
  5. You should now see the Call Center Definition you just imported:
    Salesforce: Call center definition

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.

Salesforce: manage call center users

Once you have finished adding users, you should see a screen that looks like this:

Salesforce: Flex call center UI

Configure the Salesforce Softphone layout

1. Under Call Center in the left-hand search bar, click on Softphone Layouts.

Salesforce: Find softphone layout settings

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.

Flex Sales Console

Go to Utility Items

Salesforce lightning: Utility items.

Add Open CTI Softphone to your list of Utility Items.

Salesforce Lightning: Add Open CTI softphone.

Configure the Open CTI Softphone with the below values:

Salesforce Lightning: Configure Open CTI Softphone for Flex.

Enable SSO

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

  1. While logged into Salesforce, click on the App Launcher and go to the application that you've configured with Open CTI.
  2. Find Twilio Flex in the bottom left corner of the screen and click on it.
    Find Flex in your Salesforce app.
  3. You will be prompted to log in:
    Log in to Twilio Flex via Salesforce.
  4. Once logged in, you will have Twilio Flex inside of Salesforce Lightning Experience, ready to use!

Full Flex-Salesforce Integration.

Launch with Flex <> Salesforce Integration in Classic

  1. Log into your Salesforce account.
  2. Click on the App Launcher and select the Console application that you configured with Open CTI
  3. Find Twilio Flex in the bottom right corner of the screen and select it.
    Log in to Twilio Flex via Salesforce Classic.
  4. Log into Flex.
  5. Once logged in, you will have Twilio Flex inside of Salesforce Classic, ready to use!

Full Flex-Salesforce (Classic) Integration

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.

If this is not an option and third-party cookies are disabled, you must configure the Flex to use a popup for login in order to successfully log in to the Flex-Salesforce Integration:

  • From the Flex > Single sign-on page in Twilio Console, enable the Login using popup option and then click Save.

    When agents access Salesforce, the Flex-Salesforce Integration opens a dedicated popup window to log in through your identity provider. Once agents log in through your identity provider, Flex logs them in.

    Note that this setting means that the Flex login always appears in a separate popup window, not just for the Flex-Salesforce Integration.

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.

What's next?

Now that you've integrated Flex with your Salesforce instance, learn more about customizing your integration and managing interactions with your users:

Rate this page:

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.

Thank you for your feedback!

Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!