Skip to content

Latest commit

 

History

History
138 lines (92 loc) · 3.05 KB

README.md

File metadata and controls

138 lines (92 loc) · 3.05 KB

service-integrations

Note: Work in progress

A service for integrating Engage's public API with the Bullhorn API.

Setup

First you need to setup the config files, prepare the db and create the necessary bullhorn subscriptions

Config

Prepare the config file:

cp config.js.example config.js

and edit as needed.

Prepare the integration config file:

cp integration.json.example integration.json

get the API and user credentials from LP.

Run a local dynamo db

Fetch a downloadable version of DynamoDB and follow the instructions as described here.

An alternative way is to use docker:

docker run -p 8055:8000 amazon/dynamodb-local

Note that docker data will be wiped as soon as the container is stopped

Create the necessary tables:

aws --endpoint-url http://localhost:8055 dynamodb create-table \
    --table-name Integrations \
    --attribute-definitions \
        AttributeName=name,AttributeType=S \
    --key-schema \
        AttributeName=name,KeyType=HASH \
    --provisioned-throughput \
        ReadCapacityUnits=10,WriteCapacityUnits=10
aws --endpoint-url http://localhost:8055 dynamodb create-table \
    --table-name EntityUpdates \
    --attribute-definitions \
        AttributeName=entity,AttributeType=S \
        AttributeName=id,AttributeType=N \
    --key-schema \
        AttributeName=entity,KeyType=HASH \
        AttributeName=id,KeyType=RANGE \
    --provisioned-throughput \
        ReadCapacityUnits=10,WriteCapacityUnits=10

Ensure the two tables are there:

aws --endpoint-url http://localhost:8055 dynamodb list-tables

Add an integration config:

aws --endpoint-url http://localhost:8055 dynamodb put-item \
    --table-name Integrations \
    --item file://integration.json

Note: Adding a config with the same name will replace the existing one

Check pending updates in the datastore:

aws --endpoint-url http://localhost:8055 dynamodb scan \
     --table-name EntityUpdates \
     --filter-expression "entity = :entity" \
     --expression-attribute-values '{":entity":{"S":"plac:status:up"}}'

Setup subscriptions

Create the following subscription for modified Placements:

/event/subscription/placementUpdate?type=entity&names=Placement&eventTypes=UPDATED

Create the following subscription for created and modified JobSubmissionss:

/event/subscription/jobSubmissionUpdate?type=entity&names=JobSubmission&eventTypes=UPDATED,INSERTED

Create the following subscription for created Placements:

/event/subscription/placementInsert?type=entity&names=Placement&eventTypes=INSERTED

See http://bullhorn.github.io/rest-api-docs/#put-event-subscription

Running

Make sure bunyan is globally installed to get nice log messages:

npm i -g bunyan

Install nodemon to restart the server when a file is changed:

npm i -g nodemon

Run!

nodemon server.js | bunyan