Try WSO2 Cloud for Free
Sign in

All docs This doc
Skip to end of metadata
Go to start of metadata

Problem

When your organization receives new leads, details about those leads need to be shared with people who do not have direct access to Salesforce. Some need this information offline. You will also want to notify the relevant stakeholders of the new leads.

Solution

In this guide, we explain how to use the Salesforce SOAP connector to get details of your new leads' accounts (e.g., Id, name, email etc.) from Salesforce, use the Google Spreadsheet connector to add that information to a Google spreadsheet, and then, send an email alert regarding the lead creation to the relevant stakeholders (in this case, regional managers) using the Gmail connector.

How the solution works

The following diagram illustrates how the solution works. Salesforce Leads are added to Google Sheets. Sending email alerts is optional. You can configure it if required.

See the video tutorial here or a step-by-step walk-through of the video tutorial below.

Here's a step-by-step walk-though of the video tutorial:

Before you begin, follow the guides below to set up Salesforce and Google:

Let's get started.

  1. Go to WSO2 Cloud and sign up if you haven't done so already. The UI guides you through the signup process.
  2. Sign in to WSO2 Cloud and go to the Integration Cloud tab. Then, click ESB Compsite Application.
  3. Select the Local File System option and click Continue.
  4. Give an application name (e.g., SalesforceToGoogleApp) and upload this CAR file

    What is a CAR file? A Composite Application (CAR) is an archive file that has the collection of artifacts that you want to deploy in a WSO2 product instance. These artifacts are usually JAVA-based or XML configurations, designed differently for each product in the WSO2 Carbon platform. You can deploy these artifacts to generate services.

     

  5. You link to the Google spreadsheet and the Gmail account that you use in this scenario using environment variables. Download this file and change the values of the variables according to your requirements.

     Click here to read more information about the environment variables used in this file...
    env.json file
    {
    	"salesforce_lead_username":"test@wso2.com",
    	"salesforce_lead_password":"##################",
    	"salesforce_lead_loginurl":"https://login.salesforce.com/services/Soap/u/37.0",
    	"salesforce_lead_blocking":"false",
    	"salesforce_lead_interval" : 120 ,
     	"spreadsheet_lead_accessToken":"ya29.Glu",
    	"spreadsheet_lead_clientId":"###############################",
    	"spreadsheet_lead_clientSecret":"#####################",
    	"spreadsheet_lead_refreshToken":"####################",
    	"spreadsheet_lead_apiUrl":"https://sheets.googleapis.com/v4/spreadsheets",
    	"spreadsheet_lead_spreadsheetId":"1Q-RVgeVy3BxdQIGC6qSEftG1mW8wE2DUYOhnWq4of2s",
    	"spreadsheet_lead_spreadsheetRange":"Sheet1!A1",
    	"gmail_lead_userId":"hmrajas1990@gmail.com",
    	"gmail_lead_refreshToken":"##########################",
    	"gmail_lead_clientSecret":"############################",
    	"gmail_lead_clientId":"############################",
    	"gmail_lead_accessToken":"ya2i",
    	"gmail_lead_apiUrl":"https://www.googleapis.com/gmail",
    	"gmail_lead_managerEmailId":"hmrajas1990@gmail.com"
    }

    Here's a description of the properties:

      • salesforce_lead_username: user name of the salesforce account.
      • salesforce_lead_password : The password provided here is a concatenation of the user password and the security token provided by Salesforce. here 
      • salesforce_lead_loginurl : The login URL to access the Salesforce account.
      • salesforce_lead_blocking :  Indicated whether the connector needs to perform blocking invocations to Salesforce. (Supported in ESB 4.9.0 and later) 
      • salesforce_lead_interval : The interval time of the scheduled task in seconds(default 120 seconds). 
      • spreadsheet_lead_accessToken : Access token through the OAuth2 playground.
      • spreadsheet_lead_clientId :  Value of your client id, which can be obtained at Google developer console.
      • spreadsheet_lead_clientSecret : Value of your client secret, which can be obtained at Google developer console.
      • spreadsheet_lead_refreshToken : Value of the refresh token, which gets a new access token when the previous token has expired.
      • spreadsheet_lead_apiUrl : The application URL of Google Sheet version v4. 
      • spreadsheet_lead_spreadsheetId : the Unique value of the spreadsheet
      • spreadsheet_lead_spreadsheetRange : The A1 notation of the values to retrieve.
      • gmail_lead_userId : The Mail ID.
      • gmail_lead_refreshToken : Value of the refresh token, which gets a new access token when the previous token has expired.
      • gmail_lead_clientSecret : Value of your client secret, which can be obtained at Google developer console.
      • gmail_lead_clientId : Value of your client id, which can be obtained at Google developer console.
      • gmail_lead_accessToken : Value of the access token to access the Gmail REST API.
      • gmail_lead_apiUrl : The API URL of Gmail (https://www.googleapis.com/gmail).
      • gmail_lead_managerEmailId : The email ID of the regional manager.
  6. Click the Advanced Setting... link, expand the Environment Variables section, and upload the JSON file that you created in the previous step.
  7. Click the Create button at the end of the form to complete creating the application.
  8. Note that you see the application's Overview page once the application is deployed in the Cloud.

    You have now created an application in WSO2 Integration Cloud. Let's see how to test the scenario.
  9. Go to Salesforce, and create a new lead and note the following recorded in the Google spreadsheet and the Gmail you linked to in step 7 above:
    • Your spreadsheet gets updated with the information you provided when creating the new lead:
    • You get an email notification regarding the new lead:

You have now used the WSO2 connectors in the Connector store to add Salesforce leads to Google Sheets and send email alerts regarding the leads to users.

Want to customize the default use case?

In this guide, you tried the solution on WSO2 Integration Cloud. You can do the same on-premise, with your own WSO2 Enterprise Integrator instance. To modify the default scenario, see Modify the Default Salesforce to Spreadsheet Scenario.

  • No labels