Repository for WfWI integrations for: BambooHR, MS Azure Active Directory
2. There are 'production' and 'test' versions of the jobs configured on OpenFn.org. Turn on the [PROD]
jobs to sync with the live production environment. Choose to keep the [TEST]
jobs running in parallel for testing purposes.
Women for Women International would like to integrate Committed Giving with Salesforce. OpenFn will sync donation data from Committed Giving to Salesforce. In addition, OpenFn to perform duplicate checking before upserting data.
⭐📖 See this Drive folder for the compiled solution documentation and diagrams.
Flow: Committed Giving --> Salesforce
- Weekly, OpenFn will extract CSV exports of donation data from SFTP server, convert to JSON.
- OpenFn will map the converted CSVs to relevant Salesforce objects according to data element mapping specifications defined by WfWI.
- OpenFn to perform duplicate checking before upserting data in Salesforce.
- Manage “pledged” Opportunities for Recurring Donations in Salesforce (scheduling and closing where appropriate, according to business rules defined by the WFW UK Fundraising team).
See data flow here https://lucid.app/lucidchart/34c8100a-42d2-47ab-8a5a-6c406a744ed8/edit?beaconFlowId=53F1EDFE7A9CEC2A&page=0_0#
See the V2 spec for the latest detailed documentation on the current field mapping logic.
The CSV files map to these Salesforce objects as shown below:
-
Donors
CSV triggersupsertDonors.js
job, which checks for duplicates and upserts Salesforce objectsContact
(This also looks upAccounts
). -
Direct Debit
CSV triggersupsertDirectDebits.js
job, which upserts Salesforce objectsRecurring Donations
andOpportunity
. -
Transaction-DD
CSV triggersupsertTransactionDD.js
job, which upserts Salesforce objectsRecurring Donation
andOpportunity
. -
Custom DD details
CSV triggersupsertCustomDD.js
job, which upserts Salesforce objectOpportunity
. -
Card master
CSV triggersupsertCardMaster.js
job, which upserts Salesforce objectsRecurring Donation
andOpportunity
. -
Transaction-card
CSV triggersupsertTransactionCards.js
job, which upserts Salesforce objectsRecurring Donation
andOpportunity
. -
Custom CC details
CSV triggersupsertCustomCC.js
job, which upserts Salesforce objectOpportunity
-
Contacts:
Legacy_Supporter_ID__c
comes fromPersonRef
. -
Recurring Donations:
For direct debits, configured External ID
Committed_Giving_ID__c
comes fromPrimKey
+DDId
.For card master, configured External ID
Committed_Giving_ID__c
comes fromPrimKey
+CardMasterID
.For transactions DD, configured External ID
Committed_Giving_ID__c
comes fromPrimKey
+DDRefforBank
.For transactions card, configured External ID
Committed_Giving_ID__c
comes fromPrimKey
+CardMasterID
+TransactionReference
. -
Opportunity:
For card master, configured External ID CG_Pledged_Donation_ID__c
comes from CardMasterID
, RecurringCancelDate
, Occurrence
, LastCredited
, NextDate
For transaction cards, configured External ID CG_Pledged_Donation_ID__c
comes from CardMasterID
+Transaction Date
+ "Pledged".
For direct debits, configured External ID Committed_Giving_ID__c
comes from DDid
+CancelDate
+PaymentFrequency
+LastClaimDate
+NextDate
.
For transactions DD, configured External ID Committed_Giving_ID__c
comes from DDid
+Date
+"Pledged".
-
Job 1 gets the CSV files from Committed Giving and converts them to JSON. CSV files include:
Donors
,Direct Debit
,Transaction-card
,Transaction-DD
,Custom CC details
andCustom DD details
. See link to this job: https://github.com/OpenFn/women-for-women/blob/master/jobs/committed/1.fetchJSON.js -
The
upsertDonors.js
job checks for duplicates and upserts Salesforce objectsContact
. Link here: https://github.com/OpenFn/women-for-women/blob/master/jobs/committed/upsertDonors.js -
The
upsertDirectDebits.js
job upserts Salesforce objectsRecurring Donations
and `Opportunity. This job also does the following: 1) marks Open Ended Status as "Closed" on Recurring Donations to deactivate NPSP automation 2)schedules future “pledged” Opportunities & 3) closes future “pledged” Opportunities for canceled recurring donations. Link here: https://github.com/OpenFn/women-for-women/blob/master/jobs/committed/upsertDirectDebits.js -
The
upsertTransactionDD.js
job upserts Salesforce objectsRecurring Donation
. Salesforce automatically creates relatedOpportunity
andPayment
. This job also 1)marks “pledged” Opportunities for “unpaid” transactions as “Closed Lost” & 2)marks “pledged” Opportunities for “paid” transactions as “Closed Won”. Link here: https://github.com/OpenFn/women-for-women/blob/master/jobs/committed/upsertTransactionDD.js -
The
upsertCustomDD.js
job upserts Salesforce objectOpportunity
. link here: https://github.com/OpenFn/women-for-women/blob/master/jobs/committed/upsertCustomDD.js -
The
upsertCardMaster.js
job, upserts the Salesforce objectRecurring Donation
then Salesforce automatically creates related Salesforce ObjectsOpportunity
andPayment
. This also job does the following: 1) marks Open Ended Status as "Closed" on Recurring Donations to deactivate NPSP automation 2)schedules future “pledged” Opportunities & 3) closes future “pledged” Opportunities for canceled recurring donations. Link here: https://github.com/OpenFn/women-for-women/blob/master/jobs/committed/upsertCardMaster.js -
The
upsertTransactionCards.js
upserts Salesforce objectRecurring Donation
of TypeSponsorship
, if the amount is a multiple of 22. Otherwise, it upserts Salesforce objectsRecurring Donation
of TypeRecurring Donation
and creates Salesforce objectOpportunity
withStage
ofClosed Won
. In addition, if the amount is NOT a multiple of 22 and the count of transactions on a card master is more than one, it creates the Salesforce objectOpportunity
with aDonation Type
ofGeneral Giving
andStage
ofClosed Won
. This job also 1)marks “pledged” Opportunities for “unpaid” transactions as “Closed Lost” & 2)marks “pledged” Opportunities for “paid” transactions as “Closed Won”. Link here: https://github.com/OpenFn/women-for-women/blob/master/jobs/committed/upsertTransactionCards.js -
The
upsertCustomCC.js
job upserts Salesforce objectOpportunity
. link here: https://github.com/OpenFn/women-for-women/blob/master/jobs/committed/upsertCustomCC.js
Trigger Type: Message Filter A message filter trigger has been configured for each above. The job will run when a CSV file with the matching message filter is received in the project inbox.
SFTP adaptor and Salesforce adaptor
OpenFn will send automated email notifiers if:
- Duplicate donors were detected in the latest Committed Giving export → this requires WFW UK team action; they must merge dupe donors in CG
- Any of the Committed Giving file exports were not uploaded to the SFTP server before the daily OpenFn sync at 10 PM UTC → this alert will be sent to the CG support team (WFW admins may want to follow up on this to make sure there is a response). An email alert will not be triggered if an empty file is posted to the SFTP server (only if the file is missing altogether).
-
This integration automates a complex donor duplicate-check flow before upserting Salesforce
Contacts
. Please see [this diagram: CG <> Salesforce Contact Integration Flow] https://lucid.app/lucidchart/4d0b44a8-3299-431f-84b5-4b00bc713cd7/edit?beaconFlowId=BD5CBE391A037FF2&page=yw0MswWCJIR2# for a summary of the WfWI CG Contacts Duplicate Checking & Sync Logic. -
We assume that Committed Giving will name the CSV files with the following keywords: `wfwi donors' 'wfwi card master' 'wfwi direct debits' 'wfwi transactions - cards' 'wfwi transactions - dd' 'wfwi custom cc fields' 'wfwi custom dd fields'
-
New campaign codes will be added directly in Salesforce.
-
All donations prior to 01/01/2020 should be logged in Salesforce already.
-
For every
Recurring Donation
created, Salesforce automatically creates relatedOpportunity
andPayment
.
See here for the video walkthrough of the OpenFn setup.
This solution enables Women for Women administrators to automate employee registration processes to save time syncing data between their BambooHR
system and Microsoft Azure AD
(via the Microsoft Graph API
).
OpenFn configured a prototype integration to pilot this data flow by first focusing on automation for new Employee registrations & updates. In subsequent phases, we may expand this automation to handle other employee scenarios (i.e., employee termination, contractor employees, etc.).
Please see this data diagram for a review of the solution: Data Flow Diagram
BambooHR has a webhook notification service that will send OpenFn real-time notifications when changes are made to employee records in Bamboo. The fields included in this notification & how they map to Azure are listed in this mapping specification.
Depending on the Employment Status, different actions may be taken beyond Azure user record updates.
- New Employees --> Sent a "Welcome Email"
- Terminated Employees --> Helpdesk sent an email
- Employees marked as "Other" --> OpenFn logs a message in "Activity History" noting that "Employment Status does not qualify for integration."
- Only employee records belonging to Divisions specified as
Active Divisions
will be processed by the automation flow. Otherwise, the automation will skip over the record and logNo Azure action taken
. Skip to02:08
in this video for instructions on updating theactiveDivision
list, and please update the following lines in these jobs:
1. Upsert Azure User
- see L292 (const activeDivisions = ['Headquarters', 'Headquarters - PM Access'];
) https://github.com/OpenFn/women-for-women/blob/master/jobs/production/upsertUserProd.js#L2922A. Send Welcome Email
- see L16 https://github.com/OpenFn/women-for-women/blob/master/jobs/production/sendWelcomeEmailProd.js#L162B. Send Supervisor Email
- see L16 https://github.com/OpenFn/women-for-women/blob/master/jobs/production/sendSupervisorEmailProd.js#L163. Send Inactive Employee Email
- see L16 https://github.com/OpenFn/women-for-women/blob/master/jobs/production/sendInactiveEmailProd.js#L16
For this pilot integration setup, OpenFn will sync BambooHR Employee
information with AzureAD users
in a one-directional data flow. This includes automation to execute the following actions in Azure:
- Upsert
users
- Assign a
manager
- Add
user
as a member toadministrativeUnits
- Add
user
as a member togroups
(and thereby assign licenses)
- When POST succeeds:
Authentication successful
- When manager assigned:
Assigning ${fields['First name Last name']} (${employee.fields.Employee #} to manager ${supervisorEmail} ...
- When assigned manager not found:
Manager ${employee.fields['Supervisor email']} not found...
- When member removed from an administrative unit:
Removing member from the administrative unit ${value[0]}...
- When member added to an administrative unit:
Adding member to the administrative units ${employee.fields.Division}...
- When member removed from group:
Removing member from the group ${value[0]}...
- When member added to group:
Adding member to the group ${employee.fields['Email User Type']}...
- When upserting a user record, but no work e-mail address provided in BambooHR:
No Azure actions taken because 'Work Email' not provided.
- When updating a user record:
Updating ${employee.fields.First name Last name} (${employee.fields.Employee #} information...
- When employment status does not comply with criteria requirements for integration:
No Azure changes made. Employment Status does not qualify for integration. Nothing to update for ${employee.fields.First name Last name} (${employee.fields.Employee #} at this time.
- When Employee ID and User Principle Name do not match:
${employee.fields.First name Last name} User Principal Name ($UserPrincipalName}) and Bamboo Work Email ({$employee.Work Email}) do not match. Please review this employee {employee.Employee #} to confirm the email and UPN are correct.
- When a user is not found a new user is created succesfully:
Creating a new user for ${employee.fields.First name Last name} ...
OpenFn is leveraging the adaptor language-http
to connect with the Microsoft Graph API
in order to perform operations in Azure AD and across other Microsoft products. See API Docs: https://docs.microsoft.com/en-us/graph/
- We are authorizing with Azure AD
on behalf of a user
- see docs here - To enable this, Admin users needs to grant
Delegated Permissions
via the API Permissions menu item in the Azure AD Portal
Discussed functionality may include:
- Additional automated actions when a user is terminated (consider integration with Jira or Microsoft form to trigger this?
- Syncing of profile photos
- Two-way sync capabilities
- Conversion of special characters
Contact [email protected].