Giter Club home page Giter Club logo

frontline-salesforce-serverless-quickstart's Introduction

Twilio Frontline Salesforce CRM Integration

NOTE: Effective February 9, 2023, Twilio Frontline is limited to existing Frontline accounts only. New and existing Twilio customers without previous access to Frontline will not be able to get Frontline through Twilio's Console nor access developer documentation. For more information, please check out the Twilio Frontline Support documentation.

This Twilio Functions service implements the Frontline callbacks and Conversations callbacks to faciliate inbound and outbound SMS and WhatsApp support for Twilio Frontline based on Contact ownership in Salesforce.

How it works

The Functions implement the following Frontline and Conversations callbacks:

Frontline

Conversations

Screenshots

The following screenshots show the Frontline worker screens for SMS as well as Frontline worker WhatsApp template selection and customer receipt of the WhatsApp template:

Customer List and Details

Outbound SMS Conversation

Outbound WhatsApp Templates

Pre-requisites

To deploy these Frontline Functions, you will need:

  • An active Twilio account with Frontline and approved WhatsApp Senders and Templates
  • SSO configured for your Frontline instance. This ensures that the Salesforce and Frontline accounts can be linked securely using a common SSO identity provider.
  • A new, unique Sync service SID within the Frontline Twilio account to cache Salesforce access tokens
  • npm version 5.0.0 or later installed (type npm -v in your terminal to check)
  • Node.js version 12 or later installed (type node -v in your terminal to check)
  • Twilio CLI along with the Serverless Plugin. Run the following commands to install them:
    # Install the Twilio CLI
    npm install twilio-cli -g
    # Install the Serverless Plugin
    twilio plugins:install @twilio-labs/plugin-serverless
  • Salesforce Developer or Sandbox Org. with System Administrator access

Salesforce Connected App

Create a Salesforce Connected App under Salesforce Setup > App Manager > New Connected App with at least Access and manage your data (api) and Perform requests on your behalf at any time (refresh_token, offline_access) OAuth scopes. The Callback URL can be https://login.salesforce.com/services/oauth2/success and is only used during the initial setup.

Select "Use digital signatures" and follow Salesforce's instructions to Create a Private Key and Self-Signed Digital Certificate

  • Upload the resulting server.crt file to Salesforce by selecting "Choose File" next to "Use digital signatures"
  • Place your private key server.key in a cloned version of this respository at the path assets/server.private.key
  • Authorize your Salesforce Org. Using the JWT Bearer Flow

Functions Setup

  1. Clone this repo:
git clone https://github.com/twilio-labs/frontline-salesforce-serverless-quickstart
  1. Install the dependencies
# Install the dependencies of the Twilio Functions
npm install
  1. Copy the .env.example file
cp .env.example .env
  1. Edit .env:
  ACCOUNT_SID=Found at https://www.twilio.com/console
  AUTH_TOKEN=Found at https://www.twilio.com/console 
  SF_CONSUMER_KEY=Your Salesforce Connected App OAuth Client ID
  SF_USERNAME=The username to make JWT bearer token Salesforce API calls for inbound callbacks lacking user context to the webhook request
  SFDC_INSTANCE_URL=Your Salesforce instance URL, e.g. https://abc-dev-ed.my.salesforce.com
  WHATSAPP_NUMBER=WhatsApp number for outbound conversations proxy address
  SMS_NUMBER=SMS number for outbound conversations proxy address
  DEFAULT_WORKER=The default Frontline worker for inbound conversation routing if no matching Contact Owner is found in Salesforce
  SYNC_SERVICE_SID=The Sync Service SID used to store Salesforce access tokens

Development

In order to develop locally, you can use the twilio-run CLI by running (from the root directory):

# Start Twilio Functions
twilio serverless:start

This will automatically start up the Twilio Serverless local development server. Your app will run on http://localhost:3000.

Deploy

When you are ready, deploy your Twilio Functions:

twilio serverless:deploy

frontline-salesforce-serverless-quickstart's People

Contributors

danjea avatar dependabot[bot] avatar randyjohnston avatar thecavepeanut avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

dsmwong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.