The Google Apps Script Dropzone Connector bridges the SendSafely Dropzone and the Salesforce platform. The script ingests the SendSafely-generated secure link & related metadata, and updates the target Salesforce case via the Salesforce REST API. If the case is unable to be updated via the Salesforce API call, a notification email is sent to the Dropzone owner and file submitter.
This article assumes the following prerequisites:
- You already have a SendSafely account with a Dropzone enabled. Refer to the “Initial Dropzone Setup” section of this article for steps on how to enable: https://sendsafely.zendesk.com/hc/en-us/articles/360004713432-Hosted-Dropzone-Set-Up
- You have set up a new Connected App in Salesforce: https://sendsafely.zendesk.com/hc/en-us/articles/360040234451
- You have obtained the Google Apps Script (Code) for the SendSafely Dropzone Connector from your SendSafely Integration Consultant
- You have permissions within GSuite to setup and deploy new resources. Specifically you will need permission to allow users in yourdomain.com to publish files on the web or make them visible to the world as public or unlisted files. From the Admin panel:
- Google Drive > Sharing Settings > Sharing Options > Sharing Outside of Domain "ON" > Allow users in yourdomain.com to publish files on the web or make them visible to the world as public or unlisted files
Step-by-Step Integration Guide
To proceed, make sure you have a copy of the latest SendSafely Dropzone Connector Google Apps Script. You can request a copy from email@example.com, if not already provided. Copy the connector into your Google Apps account. From the Spreadsheet view, select the “Extensions” menu, and then “Apps Script".
At the time of this writing, the new Google Apps Script editor does not currently support editing script properties. To complete the required configuration steps below, click the “Use classic editor” button at the top right corner of the screen and proceed with the steps below.
From the Code.gs view in the Script Editor complete the following steps:
Step 1: Grant Script Permissions
Select Run > Run function > Setup. You will be prompted by Google to grant the necessary permissions for this script to work. Click “Allow”.
Step 2: Configure Script Properties
Populate the required script properties by navigating to File > Project Properties > Script Properties and entering the following fields:
- gmail_sender_address - Email address to use for sending notifications. By default this should be the Google account configured to run this script or alternatively, another email address you are authorized to send on behalf of.
- salesforce_client_id - Connected App Consumer Key from Salesforce instance. Retrieve this information from Build->Create->Apps & click “Connected App Name” link for the SendSafey Dropzone application
- salesforce_client_secret - Connected App Consumer Secret from Salesforce instance. Retrieve this information from Build->Create->Apps & click “Connected App Name” link for the SendSafely Dropzone application
- salesforce_authorization_url - If using a Salesforce Sandbox environment replace "login.salesforce.com" with "test.salesforce.com"
- salesforce_token_url - If using a Salesforce Sandbox environment replace "login.salesforce.com" with "test.salesforce.com"
- sendsafely_validation_key - SendSafely Dropzone Validation Key. Retrieve this information from the Dropzone screen of your Edit Profile page when logged into the SendSafely web portal (Account menu -> Edit Profile -> Dropzone)
- salesforce_sendsafely_link_destination - Salesforce object where SendSafely secure link will be written to. The default location is the Case Comment feed. Removal of this property will result in the secure link being written to the CaseComment object.
- company_name - Company name to appear in emails sent by this script to sender and/or recipient. Defaults to Company XYZ if not configured. Emails are only sent if an error occurs during script execution.
- helpdesk_name - Helpdesk name to appear in emails sent by this script to sender and/or recipient. Defaults to Salesforce Service Cloud if not configured. Emails are only sent if an error occurs during script execution.
- sendsafely_error_notification_address - Optional script property that defines an email address to receive email error notifications for unexpected errors encountered during Google App Script execution. The most common error being an invalid Case number. If this property is not configured, email error notifications will be sent to the Dropzone owner's email address.
Step 3. Configure Google AppScript OAuth2 Redirect URI in SendSafely Dropzone Salesforce Connected App configuration
Execute method Run > Run function > logRedirectUri. Once the method completes, do the following:
- Select View > Logs
- Copy the entire https URL for pasting into OAuth Callback URL setting in the SendSafely Dropzone Salesforce Connected App configuration
- To get to this setting in Salesforce, go to Build->Create->Apps & click the “Connected App Name” link of the SendSafey Dropzone application
- Click the “Edit” button and paste the previously copied https URL into the Callback URL text box.
**Note that Salesforce Connected Apps support multiple Callback URLs, so you can paste it below an existing URL (such as if you've already configured another Dropzone Connector to use this same Connected App) or overwrite the default Salesforce Callback URL.
- Click the “Save” button and then “Continue” button when prompted
Step 4: Authorize the script to connect to Salesforce
Execute Run > Run function > initOauth. Once the method completes, do the following:
- Select View >Logs
- Copy the entire authorization URL & paste into a new browser tab
- If prompted, authenticate to Salesforce with a user that is a member of an authorized Profile for the SendSafely Dropzone Salesforce Connected App
- A successful authorization will return "Success!" in the browser
** It may take up to 10 minutes for the OAuth2 Redirect URI setting configured in Step 3 to propagate in your Salesforce instance. If you do not get a "Success!" message and instead get the message 'error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration' at Step 4e, re-try the above after several minutes.
Step 5: Deploy script as web app
Select Publish > Deploy as web app
- Under "Project Verison", choose "New"
- Under "Execute as" choose "me"
- Under "Who has access" choose "anyone, even anonymous"
Step 6: Update SendSafely Dropzone webhook
After pressing "Deploy" copy the Current web app URL and do the following:
- Log into the SendSafely web portal and navigate to Edit Profile-> Dropzone.
- Paste the copied URL into the "Use a Webhook for notifications:" under Notification Settings.
****NOTE: To assist with testing and/or troubleshooting connectivity to your Salesforce environment, refer to the testGetCase() function in SendSafely Dropzone Connector for Salesforce script.
Part 3 - Dropzone Connector Upload Test
The final step is to test the Saleforce - SendSafely Dropzone integration. Perform the following to confirm set up is complete:
Have at least 1 Case record setup in Salesforce and note down the Case number
Browse to the SendSafely Dropzone Upload URL, which will look similar to the following example URL:
Here is a template URL that you can use to construct the URL for your setup Dropzone:
- Replace SS_ENTERPRISE_HOST_NAME with the hostname of your SendSafely portal.
- Replace PUBLIC_API_KEY with the Public API Key of the Dropzone owner. This can be retrieved from the Dropzone Owner’s Edit Profile screen when logged into the SendSafely website. Look for the Public API Key section on the page.
Input the required information in the form, i.e. Case Number, Your Email Address and upload a file. Click the submit button.
Return to your Salesforce instance, and refresh the browser displaying the ticket, and you should see the Case Comments have been updated with a new comment including the SendSafely-generated link, and the uploaded file available for download from the SendSafely Canvas application.