This guide explains how you can set up a Zap to send notifications (emails, sms, etc) to the applicants listed on an opportunity when the opportunity status changes.
This guide assumes that you have a basic understanding of how Zapier works and the related Zapier terms (actions, triggers, filters, etc).
Step-by-step guide
Step 1: Trigger Setup
Create a new Zap
Select Mercury Connect app as the trigger application
In the trigger setup select the Opportunity Status Updated trigger
Press continue and provide mercury authentication details so the trigger can communicate with Mercury.
Leave the default options as they are on the Edit Options Page and press continue
Press Fetch & Continue on the Test Mercury Connect page to pull in some samples.
If all went well, the trigger should look something like this:
Step 2: Setup Filters
Lets say we want to setup a filter which allows the zap to send notifications only when the opportunity has moved to a specific status eg. Formally Approved
Select Filter by Zapier app
In the Filter Setup & Testing section select Opportunity Status field from the Mercury trigger setup in step 1. The filter setup should be as follows
Step 3: Setup Javascript to extract the Applicant information
Select the Code by Zapier app
Select Run Javascript on page 2
In the edit template section setup the input data section as follows:
Note: For completion sake the example shows all the applicant related fields that are available on the opportunity trigger. However, you are free to limit the fields in the input data as per your requirement
In the Code window, copy paste the below script. Note: For demo purposes, the below script extracts only email, mobile, relationship and full name from the full data set. It also has a check to filter out all 'non-applicants' (eg. conveyancer, accountant, agent, etc) from the script output. Please feel free to modify the script as per your requirement
output = [];
// Uncomment the bits which you need in your recepient data
if(inputData.relationship && inputData.email && inputData.fullName && inputData.mobile /* && inputData.businessPhone && inputData.firstName
&& inputData.lastName && inputData.personID && inputData.homePhone */) {
var
obj = {};
// var businessPhones = inputData.businessPhone.split(',');
// var firstNames = inputData.firstName.split(',');
var
relationships = inputData.relationship.split(',');
var
mobiles = inputData.mobile.split(',');
// var lastNames = inputData.lastName.split(',');
// var personIDs = inputData.personID.split(',');
var
fullNames = inputData.fullName.split(',');
var
emails = inputData.email.split(',');
// var homePhones = inputData.homePhone.split(',');
for(let i=0;i<relationships.length;i++){
//Filter only those related parties which are applicants
if(relationships[i].toLowerCase().indexOf('applicant') != -1){
var
record = {}
// record.businessPhone = businessPhones[i];
// record.firstName = firstNames[i];
record.relationship = relationships[i];
record.mobile = mobiles[i];
// record.lastName = lastNames[i];
// record.personID = personIDs[i];
record.fullName = fullNames[i];
record.email = emails[i];
// record.homePhone = homePhones[i];
output.push(record);
}
}
}
return
output;
Press continue to the Test this step page and press the Send Test to Code by Zapier button
Make sure that the script doesn't run into any errors at this step. If it does, please review the script again and re-test until there are no errors
Step 4: Set up an action to send a notification
To send an email, chose an email application eg. Office 365
In the email template, in the 'To Email' field select the email field from the filter output in Step 3
Enter a relevant subject eg. Congratulations! Your loan has been approved
In the body field, enter your message. You can use any of the fields from any of the previous steps. For example, you can pick up the applicant name from the filter output in Step 3 and the opportunity amount from Step 1 as shown below
Step 5: Set up an action to send an SMS notification
To send an SMS, chose an SMS application eg. Twilio
In the SMS setup template, in the 'To Number' field select the mobile field from the filter output in Step 4
Enter a relevant message eg. Congratulations! Your loan has been approved