This project contains code for syncing Zenefits HR data with a Guidebook Guide via webhooks.
- An Amazon Web Services (AWS) account
- A Guide set up in Builder with an empty CustomList
- An API key from Builder
- A Zenefits account
- A Zenefits app key
- Create a virtualenv and run
pip install -r requirements.txt
to get the package dependencies.
This project uses webhooks in Zenefits to add, update and remove employees from a CustomList in Builder. However, an initial data load must be performed to populate the guide with data.
Steps to load data:
- Update all of the values in
settings.py
to your settings - Run
python data_loader.py
from within your virtualenv.
Steps to setup lambdas:
- Login to your AWS account and create three new lambdas
- Create deployment packages for each of the lambdas and either upload the package to AWS via the console or using lambda-uploader The lambdas are contained in:
add_new_employee_webhook_receiver.py
remove_employee_webhook_receiver.py
update_existing_employee_webhook_receiver.py
- Create an API Gateway and add the three lambdas as resources
- Add the following parameters to AWS Systems Manager (Parameter Store)
Name | Type | Value |
---|---|---|
/lambdas/zenefitswebhookreceiver/api_key |
SecureString | Your Builder API key |
/lambdas/zenefitswebhookreceiver/guide_and_list_ids |
String | List of guide and custom list ids to update in Builder, ex: (<guide1_id>, <list1_id>), (<guide2_id>, <list2_id>) |
/lambdas/zenefitswebhookreceiver/zenefits_app_key |
SecureString | Your Zenefits App Key |
- Deploy the lambdas and API Gateway
In order for the lambdas to receive data from Zenefits, several webhooks will need to be setup to push the data to our lambdas. Login to your Zenefits account and create the following webhooks:
Zenefits Events | Lambda |
---|---|
people.did_change |
update_existing_employee_webhook_receiver_lambda |
employments.did_terminate |
remove_employee_webhook_receiver |
employments.did_start |
add_new_employee_webhook_receiver_lambda |
More information about Zenefits events can be found here |