Salesforce Twilio integration using Named Credentials

Integration between Salesforce and Twilio to initiate conversation using REST APIs and Names Credentials.

Twilio is a cloud communications platform allowing developers to make and receive phone calls, send and receive text messages, and perform other communication functions using its web service APIs. The popularity of integrating Twilio service with Salesforce is increasing rapidly with the adoption of new Service Console in Salesforce.

Problem Statement

Recently for one of my client, I have setup integration with Twilio, to initiate conversation, once the campaign is created in Salesforce. To know what does the conversation means, read Twilio documentation.

What is Named Credentials?

It specifies the URL of an endpoint and its required authentication parameters in one definition. Earlier we used to create remote site settings to white-list the server endpoint and custom settings/metadata to store the credentials. But this is no more needed now, Salesforce have provided a standard way to support major authentication protocols including oAuth. You can read more in depth here.

Functionality Demo

GIT Repo:

Installation Steps:

Integration between Salesforce and Twilio to initiate Conversation when Campaign is created

  1. Deploy the code to org
  2. Update credentials in “Twilio Conversation” named credential
  3. Make sure the process builder flow “Campaign Process” is active
  4. Assign field level security for fields and put on layout
    • Twilio Conversation ID
    • Twilio API Log
  5. Test functionality by creating a Campaign